O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Open source IoT gateway: Tale of Eclipse Kura, Apache Camel and Rhiot

1.494 visualizações

Publicada em

Open source IoT gateway: Tale of Eclipse Kura, Apache Camel and Rhiot

Publicada em: Tecnologia

Open source IoT gateway: Tale of Eclipse Kura, Apache Camel and Rhiot

  1. 1. Brought to you by Henryk Konsek Open source IoT gateway Tale of Eclipse Kura, Apache Camel and Rhiot
  2. 2. Henryk Konsek - engineer at Red Hat - open source contributor - Rhiot project founder @hekonsek
  3. 3. Running Apache Camel in the Eclipse Kura server. This talk @hekonsek
  4. 4. ● Eclipse Kura ● Apache Camel ● Why Camel+Kura? ● How Camel+Kura? This talk @hekonsek
  5. 5. Eclipse Kura @hekonsek
  6. 6. OSGi-based IoT gateway for field devices. What is Eclipse Kura? @hekonsek
  7. 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. 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. 9. What is Eclipse Kura? OSGi-based IoT gateway for the field devices. @hekonsek
  10. 10. Gateway TL;DR; A proxy between field devices and a data center GATEWAY @hekonsek
  11. 11. Eclipse. Donated by Eurotech (http://eurotech.com). Who’s behind Kura? @hekonsek
  12. 12. Apache Camel @hekonsek
  13. 13. A message routing framework. What is Apache Camel? @hekonsek
  14. 14. How to orchestrate messages flow. What is message routing? ● Apache Camel ● Spring Integration ● Mule @hekonsek
  15. 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
  16. 16. Why Camel and Kura? @hekonsek
  17. 17. Camel provides ~200 OSGi-ready connectors (JMS, REST, CoAP, AMQP, MQTT…) How can Kura benefit from Camel? @hekonsek
  18. 18. Enterprise Integration Patterns (EIP) How can Kura benefit from Camel? @hekonsek
  19. 19. Prevents messages overflow. EIP - throttler @hekonsek
  20. 20. Provides SLA for the different channels. EIP - throttler @hekonsek
  21. 21. Dynamically decide where to route the message. EIP - content based router @hekonsek
  22. 22. Client side load balancing. Useful for field devices connectivity. EIP - load balancer @hekonsek
  23. 23. How can I control which parts of a field device should be running at the given moment? EIP - control bus @hekonsek
  24. 24. How Camel and Kura? @hekonsek
  25. 25. Camel OSGi bundle is started from the Kura. Kura + Camel: architecture @hekonsek
  26. 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. 27. Just deploy the route as the OSGi bundle and enjoy Camel running the Kura. Concerned about the lifecycle? @hekonsek
  28. 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. 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. 30. Loading XML Camel routes at runtime using web UI. Routes management @hekonsek
  31. 31. Camel will be soon a 1st class citizen in Kura. Camel as a core part of the Kura @hekonsek
  32. 32. http://rhiot.io Rhiot @hekonsek
  33. 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. 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. 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);
  36. 36. Thank you! Henryk Konsek hekonsek@gmail.com @hekonsek

×