m2m for java developers: mqtt with eclipse paho - eclipsecon europe 2013

50
M2M for Java Developers MQTT with Eclipse Paho

Upload: dominik-obermaier

Post on 06-May-2015

719 views

Category:

Technology


3 download

DESCRIPTION

Talk from the EclipseCon 2013. Mobile devices like smartphones and tablet computers became an integral part of our modern world and single-board computers like Raspberry Pi are cheaper today than at any time before. Simple and open Machine-to-Machine (M2M) protocols like MQTT enable these devices to communicate in an efficient manner, even in scenarios with unreliable und instable networks. This talk shows how Eclipse Paho - an Eclipse umbrella project for M2M protocols - can be utilized for professional and personal projects to build efficient and scalable solutions for (mobile) devices.

TRANSCRIPT

Page 1: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

M2M for Java DevelopersMQTT with Eclipse Paho

Page 2: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Dominik Obermaier@dobermai

excited about M2Mloves OSS

passionateArchitect & Maker Co-Founder and

CTO at dc-square

likes Open Source Hardware

Page 3: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Dominik Obermaier@dobermai

excited about M2Mloves OSS

passionateArchitect & Maker Co-Founder and

CTO at dc-square

likes Open Source HardwareK Who not?!?

Page 4: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

M2M?

Page 5: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

TECHNOLOGY THAT SUPPORTS WIRED

OR WIRELESS COMMUNICATION

BETWEEN DEVICES

Page 6: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Why should

we care?

Page 7: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

2010 2015 2020

~6.909.000.000 ~7.302.000.000 ~7.675.000.000

~12.500.000.000 ~25.000.000.000 ~50.000.000.000

[1]Source: http://www.un.org/esa/population/publications/wpp2008/wpp2008_highlights.pdf

[1]

[2]Source: http://share.cisco.com/internet-of-things.html

[2]

“Things” in the Internet

Page 8: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

0

12,500,000,000

25,000,000,000

37,500,000,000

50,000,000,000

2010 2015 2020

People Things

“Things” in the Internet

Page 9: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

0

12,500,000,000

25,000,000,000

37,500,000,000

50,000,000,000

2010 2015 2020

People Things

“Things” in the Internet

1.8x

Page 10: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

0

12,500,000,000

25,000,000,000

37,500,000,000

50,000,000,000

2010 2015 2020

People Things

“Things” in the Internet

1.8x

3.4x

Page 11: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

0

12,500,000,000

25,000,000,000

37,500,000,000

50,000,000,000

2010 2015 2020

People Things

“Things” in the Internet

1.8x

3.4x

6.5x

Page 12: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Things?

Page 13: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 14: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 15: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 16: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 17: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 18: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 19: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 20: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 21: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Another revolution?

Page 22: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Screenshot Taken from Oracle JavaOne Strategic Keynote 2013

Page 23: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

IoT

Page 24: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Which protocol

?

Page 25: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

HTTP?Request / Response

Verbose

Polling instead of Push

No quality of service

How to get notified if clients die?

Stateless

Page 26: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 27: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Why MQTT?✓ Simple

✓ Efficient

✓ Publish / Subscribe

✓ Quality of Service Levels

✓ Last Will and Testament

✓ Designed for unreliable networks

Page 28: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Why MQTT?✓ Simple

✓ Efficient

✓ Publish / Subscribe

✓ Quality of Service Levels

✓ Last Will and Testament

✓ Designed for unreliable networksK Wireless? Yep, then it probably is unreliable

Page 29: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Publish / Subscribe

Page 30: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Broker Implementations

Page 31: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Broker Implementations

Page 32: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Broker Implementations

Page 33: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Broker Implementations

Page 34: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Broker Implementations

Page 35: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Broker Implementations

Page 36: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Broker Implementations

+ others

Page 37: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Broker Implementations

+ othersExtensive list of brokers available at http://mqtt.org/wiki/doku.php/brokers

Page 38: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Noooo! Sounds like programming in C!

Page 39: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 40: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Java!

Page 41: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
Page 42: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

What is Paho?

✓ Scalable Open Source Implementations of M2M standard protocols

✓ Focus on MQTT

✓ Implementations in Java, Javascript, Lua, C, C++ and Python

✓ Eclipse Incubator

Page 43: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

What is Paho?

✓ Scalable Open Source Implementations of M2M standard protocols

✓ Focus on MQTT

✓ Implementations in Java, Javascript, Lua, C, C++ and Python

✓ Eclipse Incubator

KRead: What is Paho at the moment

Page 44: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Code! public void start() throws Exception { final String clientId = "eclipsecon_sub";

final MqttClient mqttClient = new MqttClient(BROKER_URL, clientId, new MemoryPersistence());

mqttClient.setCallback(new SubscribeCallback(mqttClient));

mqttClient.connect();

mqttClient.subscribe(TOPIC_SUBSCRIPTION, QUALITY_OF_SERVICE_LEVEL);

}

Page 45: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Moar Code!public class SubscribeCallback implements MqttCallback {

@Override public void connectionLost(Throwable cause) {}

@Override public void deliveryComplete(MqttDeliveryToken token) {}

@Override public void messageArrived(MqttTopic topic,

MqttMessage message) throws Exception {

System.out.println( "Message arrived. Topic: "

topic.getName() + ", QoS: " + message.getQos() + ", message: " + new String(message.getPayload(),Charset.forName("UTF-8")));

}}

Page 46: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

DEMO!

Page 47: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Other Eclipse M2M Projects

Page 48: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Other Eclipse M2M Projects

+ others

Page 49: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

THANKYOU!

Page 50: M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013

Credits✓ Scared Cat Picture by http://www.flickr.com/photos/

dat-pics/

✓ Thanks Vincent Le Moign for the awesome Icon Set

✓ Rest of pictures licensed from different people from 500px.com

✓ MQTT Logo by http://www.mqtt.org

✓ Paho Logo from http://wiki.eclipse.org/Paho/Branding