Iot gateway dream team - Eclipse Kura and Apache Camel

Preview:

Citation preview

Brought to you by Henryk Konsek

IoT gateway Dream TeamEclipse Kura and Apache Camel

Henryk Konsek@hekonsek

- engineer at Red Hat- open source

contributor- focused on the IoT- Rhiot project founder

Running Apache Camel in the Eclipse Kura OSGi container.

This talk

● Crash course to the IoT● Eclipse Kura● Apache Camel● Why Camel+Kura?● How Camel+Kura?● Demo

This talk

Crash course to the IoT

Hardware. Connected. And sensors.

The Internet Of Things

In drones?

Where is the IoT money?

In hipster startups?

Where is the IoT money?

In the Raspberry Pi?

Where is the IoT money?

Industry.

IoT money

Automotive.

IoT money

Assets management.

IoT money

Smart cities.

IoT money

Military & intelligence.

IoT money

IoT = Data Center + Embedded

IoT consolidates data center and embedded worlds.

The datacenter systems are located in a data center.

Datacenter systems in a nutshell

IoT architecture is a superset of a datacenter architecture.

IoT architecture

Synchronous communication, usually via HTTP.

Communication in the datacenter systems

The “IoT fun” part!

Communication in the IoT systems

Eclipse Kura

OSGi-based IoT gateway for field devices.

What is Eclipse Kura?

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)

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)

Networking Gateway Services Web UI Remote Management

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

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

What is Eclipse Kura?

OSGi-based IoT gateway for the field devices.

Gateway TL;DR;

A proxy between field devices and a data center

GATEWAY

Eclipse. Donated by Eurotech (http://eurotech.com).

Who’s behind Kura?

Apache Camel

The message routing framework.

What is Apache Camel?

How to orchestrate messages flow.

What is message routing?

● Apache Camel● Spring Integration● Mule

- 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')]

Why Camel and Kura?

Camel provides ~200 OSGi-ready connectors (JMS, REST, CoAP, AMQP, MQTT…)

How can Kura benefit from Camel?

Enterprise Integration Patterns (EIP)

How can Kura benefit from Camel?

Prevents messages overflow.

EIP - throttler

Provides SLA for the different channels.

EIP - throttler

Dynamically decide where to route the message.

EIP - content based router

Client side load balancing. Useful for field devices connectivity.

EIP - load balancer

How can gateway provide transaction-like behavior when connecting to a non-transactional service?

EIP - idempotent consumer

How can I control which parts of the field device should be running at the given moment?

EIP - control bus

How Camel and Kura?

Camel OSGi bundle is started from the Kura.

Kura + Camel: architecture

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"); } }

Just deploy the route as the OSGi bundle and enjoy Camel running the Kura.

Concerned about the lifecycle?

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"); } }

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"); } }

http://rhiot.io

Rhiot Kura gateway

- Rhiot Kura+Camel router (EuroTech partnership)- server-side components- on-going R&D and productization efforts

Rhiot & Red Hat?

Thank you!

Henryk Konsek@hekonsek

hekonsek@gmail.com

Recommended