7. OSGi-based IoT gateway for the field devices.
OSGi
● modularity system for Java
● provides modules classpath separation
● promotes hot runtime redeployments
What is Eclipse Kura?
OSGi Application Container (Eclipse Equinox, Concierge)
Java SE 7 / 8 (OpenJDK)
@hekonsek
8. What is Eclipse Kura?
IoT gateway
● collects messages from the edge devices (like sensors)
● performs messages processing/aggregation/forwarding
OSGi-based IoT gateway for the field devices.
OSGi Application Container (Eclipse Equinox, Concierge)
Java SE 7 / 8 (OpenJDK)
Serial GPIO HID BLE I2C Field protocols
Networking Gateway Services Web UI Remote Management
Cloud Services Data Services EP
Connectivity and Delivery
@hekonsek
9. What is Eclipse Kura?
OSGi-based IoT gateway for the field devices.
@hekonsek
14. How to orchestrate messages flow.
What is message routing?
● Apache Camel
● Spring Integration
● Mule
@hekonsek
15. - read message from JMS queue
- transform to JSON
- save to FTP and MongoDB
Crash course to the Apache Camel
from('jms:invoices').
transform { new Invoice(uuid(), it.in.body) }.
marshal().json(Jackson).
multicast().parallelProcessing().
to('ftp:myftp.com/invoices',
'mongodb:myDb?collection=invoices&operation=save')
]
@hekonsek
25. Camel OSGi bundle is started from the Kura.
Kura + Camel: architecture
@hekonsek
26. Invoke REST method every second.
Camel route module for Kura
public class MyKuraRouter extends KuraRouter {
@Override
public void configure() throws Exception {
from("timer:trigger").
to("netty4-http:http://app.mydatacenter.com/api");
}
}
@hekonsek
27. Just deploy the route as the OSGi bundle and enjoy Camel running the Kura.
Concerned about the lifecycle?
@hekonsek
28. Display WiFi networks accessible near the field device using the web
browser.
Fancy example #1
public class MyKuraRouter extends KuraRouter {
@Override
public void configure() throws Exception {
from("netty4-http:http://0.0.0.0:18080").
to("bean:org.eclipse.kura.net.NetworkService?method=getAllWifiAccessPoints");
}
}
@hekonsek
29. Start syncing cached data only when WiFi is accessible.
Fancy example #2
public class MyKuraRouter extends KuraRouter {
@Override
public void configure() throws Exception {
from("kura-wifi:wlan0/mySSID").
to("controlbus:route?routeId=onlineSync&action=start");
from("file:///var/sensor/temperature").
routeId("onlineSync").autoStartup(false).
to("netty4-http://api.mydatacenter.com");
}
}
@hekonsek
30. Loading XML Camel routes at runtime using web UI.
Routes management
@hekonsek
31. Camel will be soon a 1st class citizen in Kura.
Camel as a core part of the Kura
@hekonsek
33. Soon to be converted to Maven archetype :) .
Rhiot Kura quickstarts
@hekonsek
git clone git@github.com:rhiot/quickstarts.git
cp -r quickstarts/kura-camel kura-camel
cd kura-camel
mvn install
34. CloudService user doesn’t know that payload is dispatched to Camel.
Rhiot CamelCloudService
@hekonsek
CloudService cloudService = new DefaultCamelCloudService();
CloudClient client = cloudService.newCloudClient("appId");
// Publish message to internal in-memory Camel queue
cloudClient.publish("topic", "foo".getBytes(), 0, true, 0);
// Read message from Camel route
from("kura-cloud:appId/topic").
to("netty4-http:http://example.com");
35. Use CloudService to publish message to any endpoint supported by Camel.
Rhiot CamelCloudService
@hekonsek
CloudService cloudService = new DefaultCamelCloudService();
CloudClient client = cloudService.newCloudClient("appId");
cloudClient.publish("amqp:topic", "foo".getBytes(), 0, true, 0);