All Projects → eclipse → Paho.mqtt.java

eclipse / Paho.mqtt.java

Licence: other
Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Paho.mqtt.java

Paho.mqtt.android
MQTT Android
Stars: ✭ 2,334 (+44.07%)
Mutual labels:  mqtt, eclipseiot, iot, internet-of-things
Psmqtt
Utility reporting system health and status via MQTT
Stars: ✭ 95 (-94.14%)
Mutual labels:  mqtt, mqtt-client, iot, internet-of-things
Hivemq Mqtt Client
HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
Stars: ✭ 402 (-75.19%)
Mutual labels:  mqtt, mqtt-client, iot, internet-of-things
Paho.mqtt.embedded C
Paho MQTT C client library for embedded systems. Paho is an Eclipse IoT project (https://iot.eclipse.org/)
Stars: ✭ 887 (-45.25%)
Mutual labels:  mqtt, eclipseiot, iot, internet-of-things
Broadlink Mqtt
MQTT client to control BroadLink devices
Stars: ✭ 169 (-89.57%)
Mutual labels:  mqtt, mqtt-client, iot, internet-of-things
Paho.mqtt.c
An Eclipse Paho C client library for MQTT for Windows, Linux and MacOS. API documentation: https://eclipse.github.io/paho.mqtt.c/
Stars: ✭ 1,056 (-34.81%)
Mutual labels:  mqtt, eclipseiot, iot, internet-of-things
Kura
Eclipse Kura™ project - http://eclipse.org/kura
Stars: ✭ 369 (-77.22%)
Mutual labels:  eclipseiot, iot, internet-of-things
Leshan
Eclipse Leshan is an OMA Lightweight M2M (LWM2M) implementation in Java.
Stars: ✭ 483 (-70.19%)
Mutual labels:  eclipseiot, iot, internet-of-things
Core
🏡 Open source home automation that puts local control and privacy first.
Stars: ✭ 48,265 (+2879.32%)
Mutual labels:  mqtt, iot, internet-of-things
Californium
CoAP/DTLS Java Implementation
Stars: ✭ 521 (-67.84%)
Mutual labels:  eclipseiot, iot, internet-of-things
Sitewhere
SiteWhere is an industrial strength open-source application enablement platform for the Internet of Things (IoT). It provides a multi-tenant microservice-based infrastructure that includes device/asset management, data ingestion, big-data storage, and integration through a modern, scalable architecture. SiteWhere provides REST APIs for all system functionality. SiteWhere provides SDKs for many common device platforms including Android, iOS, Arduino, and any Java-capable platform such as Raspberry Pi rapidly accelerating the speed of innovation.
Stars: ✭ 788 (-51.36%)
Mutual labels:  mqtt, iot, internet-of-things
Rpieasy
Easy MultiSensor device based on Raspberry PI
Stars: ✭ 85 (-94.75%)
Mutual labels:  mqtt, iot, internet-of-things
Wakaama
Eclipse Wakaama is a C implementation of the Open Mobile Alliance's LightWeight M2M protocol (LWM2M).
Stars: ✭ 358 (-77.9%)
Mutual labels:  eclipseiot, iot, internet-of-things
Freedomotic
Open IoT Framework
Stars: ✭ 354 (-78.15%)
Mutual labels:  mqtt, iot, internet-of-things
Wolfmqtt
wolfMQTT is a small, fast, portable MQTT client implementation, including support for TLS 1.3.
Stars: ✭ 316 (-80.49%)
Mutual labels:  mqtt, mqtt-client, iot
Mqtt Panel
A web interface for MQTT
Stars: ✭ 315 (-80.56%)
Mutual labels:  mqtt, mqtt-client, iot
Smarthome
Eclipse SmartHome™ project
Stars: ✭ 867 (-46.48%)
Mutual labels:  eclipseiot, iot, internet-of-things
Mqttx
MQTT X - Elegant MQTT 5.0 Client Tool of Cross-platform
Stars: ✭ 892 (-44.94%)
Mutual labels:  mqtt, mqtt-client, iot
Mainflux
Industrial IoT Messaging and Device Management Platform
Stars: ✭ 1,341 (-17.22%)
Mutual labels:  mqtt, iot, internet-of-things
Awesome Home Assistant
A curated list of amazingly awesome Home Assistant resources.
Stars: ✭ 3,487 (+115.25%)
Mutual labels:  mqtt, iot, internet-of-things

Eclipse Paho Java Client

Build Status

The Paho Java Client is an MQTT client library written in Java for developing applications that run on the JVM or other Java compatible platforms such as Android

The Paho Java Client provides two APIs: MqttAsyncClient provides a fully asynchronous API where completion of activities is notified via registered callbacks. MqttClient is a synchronous wrapper around MqttAsyncClient where functions appear synchronous to the application.

Project description:

The Paho project has been created to provide reliable open-source implementations of open and standard messaging protocols aimed at new, existing, and emerging applications for Machine-to-Machine (M2M) and Internet of Things (IoT). Paho reflects the inherent physical and cost constraints of device connectivity. Its objectives include effective levels of decoupling between devices and applications, designed to keep markets open and encourage the rapid growth of scalable Web and Enterprise middleware and applications.

Links

Using the Paho Java Client

Downloading

Eclipse hosts a Nexus repository for those who want to use Maven to manage their dependencies. The released libraries are also available in the Maven Central repository.

Add the repository definition and the dependency definition shown below to your pom.xml.

Replace %REPOURL% with either https://repo.eclipse.org/content/repositories/paho-releases/ for the official releases, or https://repo.eclipse.org/content/repositories/paho-snapshots/ for the nightly snapshots. Replace %VERSION% with the level required .

The latest release version is 1.2.5 and the current snapshot version is 1.2.6-SNAPSHOT.

** Dependency definition for MQTTv3 client **

<project ...>
<repositories>
    <repository>
        <id>Eclipse Paho Repo</id>
        <url>%REPOURL%</url>
    </repository>
</repositories>
...
<dependencies>
    <dependency>
        <groupId>org.eclipse.paho</groupId>
        <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
        <version>%VERSION%</version>
    </dependency>
</dependencies>
</project>

** Dependency definition for MQTTv5 client **

<project ...>
<repositories>
    <repository>
        <id>Eclipse Paho Repo</id>
        <url>%REPOURL%</url>
    </repository>
</repositories>
...
<dependencies>
    <dependency>
        <groupId>org.eclipse.paho</groupId>
        <artifactId>org.eclipse.paho.mqttv5.client</artifactId>
        <version>%VERSION%</version>
    </dependency>
</dependencies>
</project>

If you find that there is functionality missing or bugs in the release version, you may want to try using the snapshot version to see if this helps before raising a feature request or an issue.

Building from source

There are two active branches on the Paho Java git repository, master which is used to produce stable releases, and develop where active development is carried out. By default cloning the git repository will download the master branch, to build from develop make sure you switch to the remote branch: git checkout -b develop remotes/origin/develop

To then build the library run the following maven command: mvn package -DskipTests

This will build the client library without running the tests. The jars for the library, source and javadoc can be found in the following directories:

org.eclipse.paho.client.mqttv3/target
org.eclipse.paho.mqttv5.client/target

Documentation

MQTTv3 reference documentation is online at: http://www.eclipse.org/paho/files/javadoc/index.html

Log and Debug in the Java Client: https://wiki.eclipse.org/Paho/Log_and_Debug_in_the_Java_client

Getting Started

The included code below is a very basic sample that connects to a server and publishes a message using the MQTTv3 synchronous API. More extensive samples demonstrating the use of the MQTTv3 and MQTTv5 Asynchronous API can be found in the org.eclipse.paho.sample directory of the source.

import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;

public class MqttPublishSample {

    public static void main(String[] args) {

        String topic        = "MQTT Examples";
        String content      = "Message from MqttPublishSample";
        int qos             = 2;
        String broker       = "tcp://iot.eclipse.org:1883";
        String clientId     = "JavaSample";
        MemoryPersistence persistence = new MemoryPersistence();

        try {
            MqttClient sampleClient = new MqttClient(broker, clientId, persistence);
            MqttConnectOptions connOpts = new MqttConnectOptions();
            connOpts.setCleanSession(true);
            System.out.println("Connecting to broker: "+broker);
            sampleClient.connect(connOpts);
            System.out.println("Connected");
            System.out.println("Publishing message: "+content);
            MqttMessage message = new MqttMessage(content.getBytes());
            message.setQos(qos);
            sampleClient.publish(topic, message);
            System.out.println("Message published");
            sampleClient.disconnect();
            System.out.println("Disconnected");
            System.exit(0);
        } catch(MqttException me) {
            System.out.println("reason "+me.getReasonCode());
            System.out.println("msg "+me.getMessage());
            System.out.println("loc "+me.getLocalizedMessage());
            System.out.println("cause "+me.getCause());
            System.out.println("excep "+me);
            me.printStackTrace();
        }
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].