Archive

Archive for May, 2015

Running camel-tinkerforge on Karaf

Running the Camel-Tinkerforge component is really easy on Karaf. The ready to go feature files make installation easy, and the use of the auto-deployment directory makes testing different route configurations also easy.

The camel-tinkerforge component is part of the Camel-labs IoT project. We just got started with this so the first release is still pending. This means you need to checkout the code from https://github.com/camel-labs/camel-labs and run “mvn install -DskipTests=true”. There’s no need to run the tests since the buildserver has already done that. 🙂

To intall Camel-Tinkerforge on Karaf 2.x run the following commands in the Shell:

features:chooseurl camel 2.15.2
features:install camel-blueprint

features:addurl mvn:com.github.camel-labs/camel-tinkerforge/0.0.0-SNAPSHOT/xml/features
features:install camel-tinkerforge

Now create a file with the following content:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="tinkerforge:/temperature/T9"/>
            <to uri="log:default"/>
        </route>
    </camelContext>
 </blueprint>

Run log:tail in the karaf Shell and copy the xml file to the deploy directory in the karaf installation directory. Notice how Karaf starts the camel routes defined in the xml file, and writes messages to the log whenever the temperature changes.

Now you can start experimenting with different routes in the xml file, and as soon as you save the file Karaf will automatically reload the routes.

Advertisements
Categories: Uncategorized