50
Brought to you by Henryk Konsek IoT gateway Dream Team Eclipse Kura and Apache Camel

Iot gateway dream team - Eclipse Kura and Apache Camel

Embed Size (px)

Citation preview

Page 1: Iot gateway dream team - Eclipse Kura and Apache Camel

Brought to you by Henryk Konsek

IoT gateway Dream TeamEclipse Kura and Apache Camel

Page 2: Iot gateway dream team - Eclipse Kura and Apache Camel

Henryk Konsek@hekonsek

- engineer at Red Hat- open source

contributor- focused on the IoT- Rhiot project founder

Page 3: Iot gateway dream team - Eclipse Kura and Apache Camel

Running Apache Camel in the Eclipse Kura OSGi container.

This talk

Page 4: Iot gateway dream team - Eclipse Kura and Apache Camel

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

This talk

Page 5: Iot gateway dream team - Eclipse Kura and Apache Camel

Crash course to the IoT

Page 6: Iot gateway dream team - Eclipse Kura and Apache Camel

Hardware. Connected. And sensors.

The Internet Of Things

Page 7: Iot gateway dream team - Eclipse Kura and Apache Camel

In drones?

Where is the IoT money?

Page 8: Iot gateway dream team - Eclipse Kura and Apache Camel

In hipster startups?

Where is the IoT money?

Page 9: Iot gateway dream team - Eclipse Kura and Apache Camel

In the Raspberry Pi?

Where is the IoT money?

Page 10: Iot gateway dream team - Eclipse Kura and Apache Camel

Industry.

IoT money

Page 11: Iot gateway dream team - Eclipse Kura and Apache Camel

Automotive.

IoT money

Page 12: Iot gateway dream team - Eclipse Kura and Apache Camel

Assets management.

IoT money

Page 13: Iot gateway dream team - Eclipse Kura and Apache Camel

Smart cities.

IoT money

Page 14: Iot gateway dream team - Eclipse Kura and Apache Camel

Military & intelligence.

IoT money

Page 15: Iot gateway dream team - Eclipse Kura and Apache Camel

IoT = Data Center + Embedded

IoT consolidates data center and embedded worlds.

Page 16: Iot gateway dream team - Eclipse Kura and Apache Camel

The datacenter systems are located in a data center.

Datacenter systems in a nutshell

Page 17: Iot gateway dream team - Eclipse Kura and Apache Camel

IoT architecture is a superset of a datacenter architecture.

IoT architecture

Page 18: Iot gateway dream team - Eclipse Kura and Apache Camel

Synchronous communication, usually via HTTP.

Communication in the datacenter systems

Page 19: Iot gateway dream team - Eclipse Kura and Apache Camel

The “IoT fun” part!

Communication in the IoT systems

Page 20: Iot gateway dream team - Eclipse Kura and Apache Camel

Eclipse Kura

Page 21: Iot gateway dream team - Eclipse Kura and Apache Camel

OSGi-based IoT gateway for field devices.

What is Eclipse Kura?

Page 22: Iot gateway dream team - Eclipse Kura and Apache Camel

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)

Page 23: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Page 24: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Page 25: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Page 26: Iot gateway dream team - Eclipse Kura and Apache Camel

What is Eclipse Kura?

OSGi-based IoT gateway for the field devices.

Page 27: Iot gateway dream team - Eclipse Kura and Apache Camel

Gateway TL;DR;

A proxy between field devices and a data center

GATEWAY

Page 28: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Who’s behind Kura?

Page 29: Iot gateway dream team - Eclipse Kura and Apache Camel

Apache Camel

Page 30: Iot gateway dream team - Eclipse Kura and Apache Camel

The message routing framework.

What is Apache Camel?

Page 31: Iot gateway dream team - Eclipse Kura and Apache Camel

How to orchestrate messages flow.

What is message routing?

● Apache Camel● Spring Integration● Mule

Page 32: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Page 33: Iot gateway dream team - Eclipse Kura and Apache Camel

Why Camel and Kura?

Page 34: Iot gateway dream team - Eclipse Kura and Apache Camel

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

How can Kura benefit from Camel?

Page 35: Iot gateway dream team - Eclipse Kura and Apache Camel

Enterprise Integration Patterns (EIP)

How can Kura benefit from Camel?

Page 36: Iot gateway dream team - Eclipse Kura and Apache Camel

Prevents messages overflow.

EIP - throttler

Page 37: Iot gateway dream team - Eclipse Kura and Apache Camel

Provides SLA for the different channels.

EIP - throttler

Page 38: Iot gateway dream team - Eclipse Kura and Apache Camel

Dynamically decide where to route the message.

EIP - content based router

Page 39: Iot gateway dream team - Eclipse Kura and Apache Camel

Client side load balancing. Useful for field devices connectivity.

EIP - load balancer

Page 40: Iot gateway dream team - Eclipse Kura and Apache Camel

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

EIP - idempotent consumer

Page 41: Iot gateway dream team - Eclipse Kura and Apache Camel

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

EIP - control bus

Page 42: Iot gateway dream team - Eclipse Kura and Apache Camel

How Camel and Kura?

Page 43: Iot gateway dream team - Eclipse Kura and Apache Camel

Camel OSGi bundle is started from the Kura.

Kura + Camel: architecture

Page 44: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Page 45: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Concerned about the lifecycle?

Page 46: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Page 47: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Page 48: Iot gateway dream team - Eclipse Kura and Apache Camel

http://rhiot.io

Rhiot Kura gateway

Page 49: Iot gateway dream team - Eclipse Kura and Apache Camel

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

Rhiot & Red Hat?

Page 50: Iot gateway dream team - Eclipse Kura and Apache Camel

Thank you!

Henryk Konsek@hekonsek

[email protected]