Skip to main content
Jump to: navigation, search

Kura/Camel Integration

< Kura
Revision as of 05:19, 22 March 2016 by Marco.carrer.eurotech.com (Talk | contribs) (Eclipse Kura / Apache Camel Integration Design Notes)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Eclipse Kura / Apache Camel Integration

The Eclipse Kura development team is collaborating with the Apache Camel community to integrate the Apache Camel into Eclipse Kura. This page illustrates the uses cases that such integration would like to address and it provide an overview of the architecture proposed.

Eclipse Kura / Apache Camel: Use Case 1

Use Camel DSL to filter messages that should be passed to the Kura publishing stack per topic and/or value. In this use case, we would like to decouple of the application logic that acquires data from the field to the application logic that determines whether such data should be published to the remote server. Using Camel DSL, developers can use a simple XML configuration to express publishing logic declaratively. The goal is to make this change transparent to the Kura developers who should able to continue to use the current publishing APIs.

Example of Kura publishing code:

    CloudClient cloudClient = cloudService.newCloudClient(“myapp”, ...);
    KuraPayload payload = new KuraPayload();
    payload.addMetric("temperature", 30);
    cloudClient.publish("mytopic", payload, 0, true);

Example of a Camel DSL XML to filter messages to be logged or published:

    <routes xmlns="http://camel.apache.org/schema/spring">
	<route id="bar">        
	    <from uri="kura-cloud:myapp/mytopic"/>
	    <filter>		
	         <simple>${body.metrics()[temperature]} >= 25</simple>	 
             <to uri="log:RECEIVED!"/>
            </filter>
        </route>
    </routes>


Eclipse Kura / Apache Camel: Use Case 2

The second use case is to leverage the 150+ Camel plugins to allow for publishing certain messages using protocols alternative to the one implemented in the Kura publishing stack.

Examples: Messages published over a certain threshold are also converted into an SNMP trap Gateway can be used to publish into non MQTT back-ends through the Camel plugins


Eclipse Kura / Apache Camel: Integration Architecture

The following diagram illustrates the proposed integration between Eclipse Kura and Apache Camel.

Kura Camel Integration.png

Kura application will ask the CloudService for CloudClient instance for a given applicationId. The returned CloudClient instance may be a wrapper over an Apache Camel route. Messages published by the application will be passed for evaluation to the Camel route associated with such application. The Camel route can filter the messages, aggregate them, publish them through the Kura publishing stack or through other Camel plugins. The CamelService is a Kura ConfigurableComponent whose configuration parameters include the Camel DSL XML for all the routes defined in the current Kura instance.

Back to the top