{"id":62973,"date":"2017-01-06T07:00:53","date_gmt":"2017-01-06T05:00:53","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=62973"},"modified":"2017-01-05T17:00:46","modified_gmt":"2017-01-05T15:00:46","slug":"getting-started-mqtt-java","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html","title":{"rendered":"Getting Started with MQTT and Java"},"content":{"rendered":"<p>MQTT (MQ Telemetry Transport) is a lightweight publish\/subscribe messaging protocol. MQTT is used a lot in the Internet of Things applications, since it has been designed to run on remote locations with system with small footprint.<\/p>\n<p>The MQTT 3.1 is an OASIS standard, and you can find all the information at http:\/\/mqtt.org\/<\/p>\n<p>This article will guide you into the various steps to run your first MQTT application:<\/p>\n<ol>\n<li>Install and Start a MQTT Broker<\/li>\n<li>Write an application that publishes messages<\/li>\n<li>Write an application that consumes messages<\/li>\n<\/ol>\n<p>The source code of the sample application is available on <a href=\"https:\/\/github.com\/tgrall\/mqtt-sample-java\">GitHub<\/a>.<a name=\"more\"><\/a><\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>Apache Maven 3.x<\/li>\n<li>Git<\/li>\n<\/ul>\n<h3>Install and Start a MQTT Broker<\/h3>\n<p>You can find many MQTT Brokers, for this example I will use one of the most common broker <a href=\"https:\/\/mosquitto.org\">Mosquitto<\/a>.<\/p>\n<p>You can download and install from the <a href=\"https:\/\/mosquitto.org\/download\/\">binary package<\/a>. I have used <a href=\"http:\/\/brew.sh\/\">Homebrew<\/a> to install it on my Mac:<\/p>\n<pre class=\"brush:java\">$ brew install mosquitto<\/pre>\n<p>Start the MQTT Broker with the default configuration<\/p>\n<pre class=\"brush:java\">$ \/usr\/local\/sbin\/mosquitto<\/pre>\n<h3>Publish and Consume messages<\/h3>\n<p>Open two terminal windows and run the following commands :<\/p>\n<p>Consume<\/p>\n<pre class=\"brush:java\">$ mosquitto_sub -h 127.0.0.1 -t iot_data<\/pre>\n<p>Publish<\/p>\n<pre class=\"brush:java\">$ mosquitto_pub -h 127.0.0.1 -t iot_data -m \"Hello world\"<\/pre>\n<p>You should see the message <code>Hello world<\/code> in the consumer\/subscriber window.<\/p>\n<h3>Write your first MQTT Application<\/h3>\n<p>For this example I will write a small Java application, since it is the language that I am using in my global project.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2>Maven Dependencies<\/h2>\n<p>Add the <a href=\"https:\/\/eclipse.org\/paho\/\">Eclipse Paho<\/a> dependency to your Maven project<\/p>\n<pre class=\"brush:xml\">&lt;dependency&gt;\r\n  &lt;groupId&gt;org.eclipse.paho&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;org.eclipse.paho.client.mqttv3&lt;\/artifactId&gt;\r\n  &lt;version&gt;1.1.0&lt;\/version&gt;\r\n&lt;\/dependency&gt;<\/pre>\n<h2>Publishing a Message<\/h2>\n<p>Publishing a message is quite easy, create a MqttClient and use it to post on a topic.<\/p>\n<pre class=\"brush:java\">MqttClient client = new MqttClient(\"tcp:\/\/localhost:1883\", MqttClient.generateClientId());\r\nclient.connect();\r\nMqttMessage message = new MqttMessage();\r\nmessage.setPayload(\"Hello world from Java\".getBytes());\r\nclient.publish(\"iot_data\", message);\r\nclient.disconnect();<\/pre>\n<p>You have many other options, configurations that you can use when posting a message such as security, quality of service (QoS), and more; but in this post I want to simply show how easy is to publish and consume MQTT messages.<\/p>\n<h2>Consuming messages<\/h2>\n<p>To consume messages you need to implement a <code>org.eclipse.paho.client.mqttv3.MqttCallback<\/code> that will receive the message and used this Callback class in the MqttClient of the Subscriber application.<\/p>\n<p>The Callback class:<\/p>\n<pre class=\"brush:java\">public class SimpleMqttCallBack implements MqttCallback {\r\n\r\n  public void connectionLost(Throwable throwable) {\r\n    System.out.println(\"Connection to MQTT broker lost!\");\r\n  }\r\n\r\n  public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {\r\n    System.out.println(\"Message received:\\n\\t\"+ new String(mqttMessage.getPayload()) );\r\n  }\r\n\r\n  public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {\r\n    \/\/ not used in this example\r\n  }\r\n}<\/pre>\n<p>This Callback class is used in the Subscriber application as follow:<\/p>\n<pre class=\"brush:java\">MqttClient client=new MqttClient(\"tcp:\/\/localhost:1883\", MqttClient.generateClientId());\r\nclient.setCallback( new SimpleMqttCallBack() );\r\nclient.connect();<\/pre>\n<p>Like for the publisher, I am using the broker and client without any option (QoS, security).<\/p>\n<h2>Build and Run the Application<\/h2>\n<p><strong>1- Get the Sample Code<\/strong><\/p>\n<p>Clone the project from GitHub<\/p>\n<pre class=\"brush:java\">$ git clone https:\/\/github.com\/tgrall\/mqtt-sample-java.git<\/pre>\n<p><strong>2- Build the project with Apache Maven:<\/strong><\/p>\n<p>This project is a simple Java application that runs a publisher and subscriber using the <a href=\"https:\/\/eclipse.org\/paho\/\">Eclipse Paho library<\/a>.<\/p>\n<pre class=\"brush:java\">$ mvn clean package<\/pre>\n<p>For convenience, the example programs project is set up so that the maven package target produces a single executable, <code>\/mqtt-sample<\/code>, that includes all of the example programs and dependencies.<\/p>\n<p><strong>3- Run the Subscriber<\/strong><\/p>\n<p>The subscriber will receive and print all messages published on the <code>iot_data<\/code> topic.<\/p>\n<pre class=\"brush:java\">$ .\/target\/mqtt-sample subscriber<\/pre>\n<p><strong>4- Run the Publisher<\/strong><\/p>\n<p>Run the publisher with the following command, the second parameter is the message to publish<\/p>\n<pre class=\"brush:java\">$ .\/target\/mqtt-sample publisher \"My first MQTT message...\"<\/pre>\n<h2>Conclusion<\/h2>\n<p>In this article you have learned how to:<\/p>\n<ul>\n<li>Install and start a MQTT Broker, Mosquitto<\/li>\n<li>Create a publisher and subscriber developed in Java<\/li>\n<\/ul>\n<p>This article is very simple by choice, to quickly run your first MQTT Application. I wrote this article as part of a global IoT project I am working on that will capture devices data, publish them into MapR Converged Data Platform using MQTT and MapR Streams; this is why I used Java for the application. You can use any MQTT client library to build the publishers and subscribers.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/tugdualgrall.blogspot.com\/2017\/01\/getting-started-with-mqtt-and-java.html\">Getting Started with MQTT and Java<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\">JCG partner<\/a> Tugdual Grall at the <a href=\"http:\/\/tugdualgrall.blogspot.com\/\">Tug&#8217;s Blog<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>MQTT (MQ Telemetry Transport) is a lightweight publish\/subscribe messaging protocol. MQTT is used a lot in the Internet of Things applications, since it has been designed to run on remote locations with system with small footprint. The MQTT 3.1 is an OASIS standard, and you can find all the information at http:\/\/mqtt.org\/ This article will &hellip;<\/p>\n","protected":false},"author":211,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[1027,1087],"class_list":["post-62973","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-iot","tag-mqtt"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Getting Started with MQTT and Java - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"MQTT (MQ Telemetry Transport) is a lightweight publish\/subscribe messaging protocol. MQTT is used a lot in the Internet of Things applications, since it\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting Started with MQTT and Java - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"MQTT (MQ Telemetry Transport) is a lightweight publish\/subscribe messaging protocol. MQTT is used a lot in the Internet of Things applications, since it\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/tgrall\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-06T05:00:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Tugdual Grall\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/tgrall\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tugdual Grall\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html\"},\"author\":{\"name\":\"Tugdual Grall\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b52921fffd460d1dd6c706aab3408681\"},\"headline\":\"Getting Started with MQTT and Java\",\"datePublished\":\"2017-01-06T05:00:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html\"},\"wordCount\":557,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"IoT\",\"MQTT\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html\",\"name\":\"Getting Started with MQTT and Java - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2017-01-06T05:00:53+00:00\",\"description\":\"MQTT (MQ Telemetry Transport) is a lightweight publish\\\/subscribe messaging protocol. MQTT is used a lot in the Internet of Things applications, since it\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/01\\\/getting-started-mqtt-java.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Getting Started with MQTT and Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b52921fffd460d1dd6c706aab3408681\",\"name\":\"Tugdual Grall\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/af1b68cee45f3bf495c2cd03b3a14abbb56b53dcad9ef92afc7d387842ef9d72?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/af1b68cee45f3bf495c2cd03b3a14abbb56b53dcad9ef92afc7d387842ef9d72?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/af1b68cee45f3bf495c2cd03b3a14abbb56b53dcad9ef92afc7d387842ef9d72?s=96&d=mm&r=g\",\"caption\":\"Tugdual Grall\"},\"description\":\"Tugdual Grall, an open source advocate and a passionate developer, is a Chief Technical Evangelist EMEA at MapR. He currently works with the European developer communities to ease MapR, Hadoop, and NoSQL adoption. Before joining MapR, Tug was Technical Evangelist at MongoDB and Couchbase. Tug has also worked as CTO at eXo Platform and JavaEE product manager, and software engineer at Oracle. Tugdual is Co-Founder of the Nantes JUG (Java User Group) that holds since 2008 monthly meeting about Java ecosystem. Tugdual also writes a blog available at http:\\\/\\\/tgrall.github.io\\\/\",\"sameAs\":[\"http:\\\/\\\/tgrall.github.io\\\/\",\"https:\\\/\\\/www.facebook.com\\\/tgrall\",\"http:\\\/\\\/www.linkedin.com\\\/in\\\/tugdualgrall\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/tgrall\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/tugdual-grall\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting Started with MQTT and Java - Java Code Geeks","description":"MQTT (MQ Telemetry Transport) is a lightweight publish\/subscribe messaging protocol. MQTT is used a lot in the Internet of Things applications, since it","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html","og_locale":"en_US","og_type":"article","og_title":"Getting Started with MQTT and Java - Java Code Geeks","og_description":"MQTT (MQ Telemetry Transport) is a lightweight publish\/subscribe messaging protocol. MQTT is used a lot in the Internet of Things applications, since it","og_url":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/tgrall","article_published_time":"2017-01-06T05:00:53+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Tugdual Grall","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/tgrall","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Tugdual Grall","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html"},"author":{"name":"Tugdual Grall","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b52921fffd460d1dd6c706aab3408681"},"headline":"Getting Started with MQTT and Java","datePublished":"2017-01-06T05:00:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html"},"wordCount":557,"commentCount":2,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["IoT","MQTT"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html","url":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html","name":"Getting Started with MQTT and Java - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2017-01-06T05:00:53+00:00","description":"MQTT (MQ Telemetry Transport) is a lightweight publish\/subscribe messaging protocol. MQTT is used a lot in the Internet of Things applications, since it","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2017\/01\/getting-started-mqtt-java.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Getting Started with MQTT and Java"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b52921fffd460d1dd6c706aab3408681","name":"Tugdual Grall","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/af1b68cee45f3bf495c2cd03b3a14abbb56b53dcad9ef92afc7d387842ef9d72?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/af1b68cee45f3bf495c2cd03b3a14abbb56b53dcad9ef92afc7d387842ef9d72?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/af1b68cee45f3bf495c2cd03b3a14abbb56b53dcad9ef92afc7d387842ef9d72?s=96&d=mm&r=g","caption":"Tugdual Grall"},"description":"Tugdual Grall, an open source advocate and a passionate developer, is a Chief Technical Evangelist EMEA at MapR. He currently works with the European developer communities to ease MapR, Hadoop, and NoSQL adoption. Before joining MapR, Tug was Technical Evangelist at MongoDB and Couchbase. Tug has also worked as CTO at eXo Platform and JavaEE product manager, and software engineer at Oracle. Tugdual is Co-Founder of the Nantes JUG (Java User Group) that holds since 2008 monthly meeting about Java ecosystem. Tugdual also writes a blog available at http:\/\/tgrall.github.io\/","sameAs":["http:\/\/tgrall.github.io\/","https:\/\/www.facebook.com\/tgrall","http:\/\/www.linkedin.com\/in\/tugdualgrall","https:\/\/x.com\/http:\/\/twitter.com\/tgrall"],"url":"https:\/\/www.javacodegeeks.com\/author\/tugdual-grall"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/62973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/211"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=62973"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/62973\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=62973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=62973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=62973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}