Camel Kura router
Avaliable since Rhiot 0.1.3: Rhiot provides io.rhiot.component.kura.router.RhiotKuraRouter
class, which extends org.apache.camel.component.kura.KuraRouter
class from the Apache Camel camel-kura module. While KuraRouter
provides a generic base for Kura routes, it doesn't rely on the Kura-specific jars, because of limitations of the Apache Camel policy regarding adding 3rd parties repositories to the Camel (like Eclipse Kura repository). RhiotKuraRouter
extends KuraRouter
and enhances it with Kura-specific API.
This component can be used only in the Kura server - it doesn't work with a mini gateway.
Maven dependency
In order to start using RhiotKuraRouter
, Maven users should add the following dependency to their POM file:
io.rhiotcamel-kura${rhiot.version}
Adding Rhiot camel-kura
module to your project, imports transitive Kura dependencies. This is big advantage over Apache Camel camel-kura module, which doesn't rely on Kura API and therefore doesn't import Kura jars.
Usage
The principle of using RhiotKuraRouter
is the same as using KuraRouter
i.e. just extend RhiotKuraRouter
class:
Loading XML routes using SCR property
RhiotKuraRouter
comes with a RhiotKuraRouter#updated(Map<String, Object>)
method. The primary purpose of this callback is to allow a router to be a SCR component configured using the Kura Web UI and EuroTech Everyware Cloud, however you can use this callback outside the web UI and Everyware Cloud context.
Whenever RhiotKuraRouter#updated(Map<String, Object>)
callback is executed, RhiotKuraRouter
tries to read camel.route.xml
property value (RhiotKuraConstants.XML_ROUTE_PROPERTY
key constant), to parse its value and load it as an XML Camel routes. For example if the camel.route.xml
property will be set to the following value...
...new route will be automatically started (or updated if route with ID equal to mqttLogger
already exists).
Managing XML Camel routes using web UI
All RhiotKuraRouter
instances implements Kura's ConfigurableComponent
interface. It means that those can be configured using Kura web UI.
We highly recommend to use our Kura Camel quickstart as a template for creating Kura Camel routers. Our quickstart is configured as SCR component, so you can just deploy it to the Kura server and see your gateway route module deployed as a configurable service. To specify the route XML that should be loaded by a Camel context running in a deployed module, edit the camel.route.xml
service property and click Apply
button. As soon as Apply
button is clicked, the route will be parsed and loaded.
Our Kura Camel quickstart can be also used from the EuroTech Everyware Cloud (EC).
Camel Kura PojoSR test facility
This facility is intended to be used to test Camel routes to be deployed on a Kura server. Just instantiate a new io.rhiot.component.kura.PojosrKuraServer
and call its start
method passing your Camel route.
This will instantiate an OSGi registry, add your Camel route and its dependencies to the classpath and execute your route.
Last updated