In my previous post about Camel and Kura integration I demonstrated how to easily deploy Camel routes into Kura using Rhiot. In this article I would like to elaborate a little bit on how to manage Camel routes from the level of the Kura web UI.
Loading XML routes using SCR property
RhiotKuraRouter comes with a RhiotKuraRouter#updated(Map
<routes xmlns="http://camel.apache.org/schema/spring"> <route id="mqttLogger"> <from uri="paho:topic?brokerUrl=tcp:brokerhost:1883"/> <to uri="log:messages"/> </route> </routes>
...new route will be automatically started (or updated if route with ID equal to mqttLogger already exists).
All the above basically mean that if you register your Kura router as OSGi declarative service, you will be able to dynamically load and update XML routes using OSGi configuration admin service.
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.
I highly recommend to use Rhiot 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).
Maintenance of the Kura routes at runtime
The ability to maintain Camel routes from web UI without restarting a Kura server is extremely important when it comes to the long term maintenance of your IoT gateway solution. It allows to modify a flow of the existing message routes or create new rules without affecting an uptime of your production environment.
Production-level grade IoT gateway (Kura) and powerful messaging framework (Camel) are an example of a perfect combination of two mature technologies which used together result in a solid, but flexible Internet Of Things solution.