MQTT client JAVA 和 MQTT broker

来源:互联网 发布:鸡鸣狗吠,兄嫂当知之 编辑:程序博客网 时间:2024/05/20 14:42

Get the latest official version 

Apollo 1.7.1

Release Notes | Installation Instructions | Documentation

 

Binaries for Unix/Linux/OS X:apache-apollo-1.7.1-unix-distro.tar.gzGPG SignatureBinaries for Windows:apache-apollo-1.7.1-windows-distro.zipGPG SignatureSource Code Distribution:apollo-project-1.7.1-source-release.tar.gzGPG Signature

 

Show older versions...

Development Snapshot

Want to help stablize the latest and greatest nightly development build? Warnning: These builds are extremely bleeding edge!

These development builds are automatically tested and deployed by a Jenkins CI server:

  • Checkin Build and Test Results
  • Nightly SNAPSHOT deployment Results

Apollo 99-trunk-SNAPSHOT

Installation Instructions | Documentation

 

Binaries for Unix/Linux/OS X:apache-apollo-99-trunk-SNAPSHOT-unix-distro.tar.gzBinaries for Windows:apache-apollo-99-trunk-SNAPSHOT-windows-distro.zip

 

The development build source code should be directly checked out from our source code repository

 

 

MQTT client JAVA

A Java MQTT Client http://mqtt-client.fusesource.org/

 

MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.

mqtt-client provides an ASL 2.0 licensed API to MQTT. It takes care of automatically reconnecting to your MQTT server and restoring your client session if any network failures occur. Applications can use a blocking API style, a futures based API, or a callback/continuations passing API style.

Using from Maven

Add the following to your maven pom.xml file.

 

<dependency>  <groupId>org.fusesource.mqtt-client</groupId>  <artifactId>mqtt-client</artifactId>  <version>1.12</version></dependency>

Using from Gradle

Add the following to your gradle file.

 

compile 'org.fusesource.mqtt-client:mqtt-client:1.12'

Using from any Other Build System

Download the uber jar file and add it to your build. The uber contains all the stripped down dependencies which the mqtt-client depends on from other projects.

Using on Java 1.4

We also provide an java 1.4 uber jar file which is compatible with Java 1.4 JVMs. This version of the jar does not support SSL connections since the SSLEngine class used to implement SSL on NIO was not introduced until Java 1.5.

Configuring the MQTT Connection

The blocking, future, and callback APIs all share the same connection setup. You create a new instance of the MQTT class and configure it with connection and socket related options. At a minimum the setHost method be called before attempting to connect.

 

MQTT mqtt = new MQTT();mqtt.setHost("localhost", 1883);// or mqtt.setHost("tcp://localhost:1883");

 

 

 

 

 

 

 

原创粉丝点击