Eclipse Kura is an OSGi based framework dedicated for the M2M gateways based on the small computing platforms like Raspberry Pi or BeagleBoard Black. If you consider using Kura in your M2M gateway and and the same time you would like to take advantage of the rich set of Apache Camel components and its EIP capabilities, then Camel Kura component is something for you. Camel Kura component will be available starting from the Camel 2.15.0.
Camel Kura architectureThe common reason to deploy Camel routes into the Eclipse Kura is to provide enterprise integration patterns and Camel components to the messaging M2M gateway. For example you might want to install Kura on Raspberry PI, then read temperature from the sensor attached to that Raspberry PI using Kura services and finally forward the current temperature value to your data center service using Camel EIP and components. The diagram below demonstrates the architecture of the Camel solution deployed into the Eclipse Kura:
How can I activate my route?
Bundles deployed to the Eclipse Kura are usually developed as bundle activators. So the easiest way to deploy Apache Camel routes into the Kura is to create an OSGi bundle containing the class extending
Keep in mind that
org.osgi.framework.BundleActivatorinterface, so you need to register its
stoplifecycle methods while creating Kura bundle component class.
Kura router starts its own OSGi-aware
CamelContext. It means that for every class extending
KuraRouter, there will be a dedicated
CamelContextinstance. Ideally we recommend to deploy one
KuraRouterper OSGi bundle.
How can I deploy my KuraRouter
Bundle containing your Kura router class should import the following packages in the OSGi manifest:
Keep in mind that you don't have to import every Camel component bundle you plan to use in your routes, as Camel components are resolved as the services on the runtime level.
Before you deploy your router bundle, be sure that you have deployed (and started) the following Camel core bundles (using Kura GoGo shell)...
...and all the components you plan to use in your routes:
Then finally deploy your router bundle:
Some KuraRouter utilities to make your life easier
Kura router base class provides many useful utilities. Let 's explore some of them.
Kura uses SLF4J facade for logging purposes. Protected member
logreturns SLF4J logger instance associated with the given Kura router.
bundleContextreturns bundle context associated with the given Kura router.
CamelContextassociated with the given Kura router.
OSGi service resolver
OSGi service resolver (
service(Class) can be used to easily retrieve service by type from the OSGi bundle context.
How can I configure CamelContext used by KuraRouter?
Kura router comes with the lifecycle callbacks that can be used to customize the way the Camel router works. For example to configure the
CamelContextinstance associated with the router just before the former is started, override
beforeStartmethod of the