Skip to content

Commit 9edc614

Browse files
committed
Merging mqttv5-new branch into develop and updating README files
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
1 parent abf6fe8 commit 9edc614

212 files changed

Lines changed: 31716 additions & 120 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@ matrix:
1111
sudo: required
1212

1313
before_install:
14-
- ./travis-install.sh
14+
- ./start-broker.sh
15+
16+
jobs:
17+
include:
18+
- stage: mqttv3 tests
19+
script: mvn --projects org.eclipse.paho.client.mqttv3,org.eclipse.paho.client.mqttv3.test test -Dtest.server_ssl_port=18885 -Dtest.server_uri=tcp://localhost:1883 -Dtest.server_websocket_uri=ws://localhost:8080 -B
20+
- stage: mqttv5 tests
21+
script: mvn --projects org.eclipse.paho.mqttv5.client clean package
1522

16-
script: mvn --projects org.eclipse.paho.client.mqttv3,org.eclipse.paho.client.mqttv3.test test -Dtest.server_ssl_port=18885 -Dtest.server_uri=tcp://localhost:1883 -Dtest.server_websocket_uri=ws://localhost:8080 -B
1723

1824
addons:
1925
apt:
2026
sources:
2127
- sourceline: 'ppa:mosquitto-dev/mosquitto-ppa'
2228
packages:
23-
- mosquitto
29+
- mosquitto

MQTTv3.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Eclipse Paho Java MQTTv3 Client
2+
3+
The Paho Java Client provides two APIs: MqttAsyncClient provides a fully asychronous API where completion of activities is notified via registered callbacks. MqttClient is a synchronous wrapper around MqttAsyncClient where functions appear synchronous to the application.
4+
5+
## Using the Paho Java MQTTv3 Client
6+
7+
### Downloading
8+
9+
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.
10+
11+
Add the repository definition and the dependency definition shown below to your pom.xml.
12+
13+
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 .
14+
The latest release version is ```1.2.0``` and the current snapshot version is ```1.2.1-SNAPSHOT```.
15+
16+
```
17+
<project ...>
18+
<repositories>
19+
<repository>
20+
<id>Eclipse Paho Repo</id>
21+
<url>%REPOURL%</url>
22+
</repository>
23+
</repositories>
24+
...
25+
<dependencies>
26+
<dependency>
27+
<groupId>org.eclipse.paho</groupId>
28+
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
29+
<version>%VERSION%</version>
30+
</dependency>
31+
</dependencies>
32+
</project>
33+
34+
```
35+
36+
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.
37+
38+
### Building from source
39+
40+
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 ```
41+
42+
To then build the library run the following maven command: ```mvn package -DskipTests```
43+
44+
This will build the client library without running the tests. The jars for the library, source and javadoc can be found in the ```org.eclipse.paho.client.mqttv3/target``` directory.
45+
46+
## Documentation
47+
Reference documentation is online at: [http://www.eclipse.org/paho/files/javadoc/index.html](http://www.eclipse.org/paho/files/javadoc/index.html)
48+
49+
Log and Debug in the Java Client: [https://wiki.eclipse.org/Paho/Log_and_Debug_in_the_Java_client](https://wiki.eclipse.org/Paho/Log_and_Debug_in_the_Java_client)
50+
51+
## Getting Started
52+
53+
The included code below is a very basic sample that connects to a server and publishes a message using the MqttClient synchronous API. More extensive samples demonstrating the use of the Asynchronous API can be found in the ```org.eclipse.paho.sample.mqttv3app``` directory of the source.
54+
55+
56+
```
57+
import org.eclipse.paho.client.mqttv3.MqttClient;
58+
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
59+
import org.eclipse.paho.client.mqttv3.MqttException;
60+
import org.eclipse.paho.client.mqttv3.MqttMessage;
61+
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
62+
63+
public class MqttPublishSample {
64+
65+
public static void main(String[] args) {
66+
67+
String topic = "MQTT Examples";
68+
String content = "Message from MqttPublishSample";
69+
int qos = 2;
70+
String broker = "tcp://iot.eclipse.org:1883";
71+
String clientId = "JavaSample";
72+
MemoryPersistence persistence = new MemoryPersistence();
73+
74+
try {
75+
MqttClient sampleClient = new MqttClient(broker, clientId, persistence);
76+
MqttConnectOptions connOpts = new MqttConnectOptions();
77+
connOpts.setCleanSession(true);
78+
System.out.println("Connecting to broker: "+broker);
79+
sampleClient.connect(connOpts);
80+
System.out.println("Connected");
81+
System.out.println("Publishing message: "+content);
82+
MqttMessage message = new MqttMessage(content.getBytes());
83+
message.setQos(qos);
84+
sampleClient.publish(topic, message);
85+
System.out.println("Message published");
86+
sampleClient.disconnect();
87+
System.out.println("Disconnected");
88+
System.exit(0);
89+
} catch(MqttException me) {
90+
System.out.println("reason "+me.getReasonCode());
91+
System.out.println("msg "+me.getMessage());
92+
System.out.println("loc "+me.getLocalizedMessage());
93+
System.out.println("cause "+me.getCause());
94+
System.out.println("excep "+me);
95+
me.printStackTrace();
96+
}
97+
}
98+
}
99+
```
100+

MQTTv5.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Eclipse Paho Java Client for MQTTv5
2+
3+
_Warning: The Paho MQTTv5 client is under active development and so can expect breaking changes whilst in the develop branch._
4+
5+
This branch of the Paho Java client is the home of the new MQTTv5 client implementation. This is very much a work in progress, so any feedback / and contributions will be appreciated.
6+
7+
The Committee Specification for MQTT Version 5.0 is available to read here: http://docs.oasis-open.org/mqtt/mqtt/v5.0/cs01/mqtt-v5.0-cs01.html.
8+
9+
The v5 client is build on the same foundations as the v3 client is, however it is targeting Java 8 and above, allowing us to take advantages of more modern Java APIs to aid development and use. Any important fixes for the core engine can be ported between the two clients to take advantage of any performance or stability improvements. It is also being heavily refactored using lessons learnt from the v3 client and feedback from the community.
10+
11+
## Plan
12+
13+
#### Project Modules:
14+
* `org.eclipse.paho.mqttv5.client` - A full client similar to the existing mqttv3 client
15+
* `org.eclipse.paho.mqttv5.common` - A common library that could be used by both a client and server, contains a packet implementation that encodes and decodes all MQTTv5 packet types.
16+
* `org.eclipse.paho.mqttv5.testClient` - A number of examples written that show off features of the v5 client.
17+
* `org.eclipse.paho.mqttv5.server` - Not yet implemented. There has been some interest in the community for a Java MQTTv5 server using the vert.x framework. Contributions are very welcome.
18+
19+
## Help, something doesn't work! / This looks terrible! / What about x!
20+
21+
This client is under active development and as such may be incomplete / broken a lot of the time right now. However, the more feedback and help we get on it, the better it will get! If you have any issues, please raise a bug against the client [here](https://github.com/eclipse/paho.mqtt.java/issues), but **please** prefix it with 'MQTTv5' so we know that it's not an issue with the current v3.1.1 client.
22+
23+
If you have any ideas about how the API should be designed going forward, then please chip in on [this](https://github.com/eclipse/paho.mqtt.java/issues/389) issue.
24+
25+
And of course, if you think of an amazing new feature for the v5 client, have a go at implementing it and submit a Pull Request against the develop branch!

README.md

Lines changed: 7 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# Eclipse Paho Java Client
2-
[![Build Status](https://travis-ci.org/eclipse/paho.mqtt.java.svg?branch=master)](https://travis-ci.org/eclipse/paho.mqtt.java)
3-
4-
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
5-
6-
The Paho Java Client provides two APIs: MqttAsyncClient provides a fully asychronous API where completion of activities is notified via registered callbacks. MqttClient is a synchronous wrapper around MqttAsyncClient where functions appear synchronous to the application.
2+
[![Build Status](https://travis-ci.org/eclipse/paho.mqtt.java.svg?branch=develop)](https://travis-ci.org/eclipse/paho.mqtt.java)
73

4+
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. This Project contains a number of Maven projects allowing you to use and test MQTTv3 and MQTTv5.
85

96
## Project description:
107

118
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).
129
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.
1310

11+
## Client Libraries and Utilities
12+
- [MQTTv3 Library](MQTTv3.md) - The Original Paho MQTTv3 Library, supports MQTT version 3.1 and 3.1.1.
13+
- [MQTTv5 Library](MQTTv5.md) - The New Paho MQTTv5 Library based on the original, Currently under active development, supports MQTT version 5.
14+
- [Paho Utility App](org.eclipse.paho.sample.utility/utility.md) - A
15+
1416

1517
## Links
1618

@@ -22,98 +24,3 @@ Paho reflects the inherent physical and cost constraints of device connectivity.
2224
- Issues: [https://github.com/eclipse/paho.mqtt.java/issues](https://github.com/eclipse/paho.mqtt.java/issues)
2325
- Mailing-list: [https://dev.eclipse.org/mailman/listinfo/paho-dev](https://dev.eclipse.org/mailman/listinfo/paho-dev)
2426

25-
## Using the Paho Java Client
26-
27-
### Downloading
28-
29-
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.
30-
31-
Add the repository definition and the dependency definition shown below to your pom.xml.
32-
33-
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 .
34-
The latest release version is ```1.2.0``` and the current snapshot version is ```1.2.1-SNAPSHOT```.
35-
36-
```
37-
<project ...>
38-
<repositories>
39-
<repository>
40-
<id>Eclipse Paho Repo</id>
41-
<url>%REPOURL%</url>
42-
</repository>
43-
</repositories>
44-
...
45-
<dependencies>
46-
<dependency>
47-
<groupId>org.eclipse.paho</groupId>
48-
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
49-
<version>%VERSION%</version>
50-
</dependency>
51-
</dependencies>
52-
</project>
53-
54-
```
55-
56-
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.
57-
58-
### Building from source
59-
60-
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 ```
61-
62-
To then build the library run the following maven command: ```mvn package -DskipTests```
63-
64-
This will build the client library without running the tests. The jars for the library, source and javadoc can be found in the ```org.eclipse.paho.client.mqttv3/target``` directory.
65-
66-
## Documentation
67-
Reference documentation is online at: [http://www.eclipse.org/paho/files/javadoc/index.html](http://www.eclipse.org/paho/files/javadoc/index.html)
68-
69-
Log and Debug in the Java Client: [https://wiki.eclipse.org/Paho/Log_and_Debug_in_the_Java_client](https://wiki.eclipse.org/Paho/Log_and_Debug_in_the_Java_client)
70-
71-
## Getting Started
72-
73-
The included code below is a very basic sample that connects to a server and publishes a message using the MqttClient synchronous API. More extensive samples demonstrating the use of the Asynchronous API can be found in the ```org.eclipse.paho.sample.mqttv3app``` directory of the source.
74-
75-
76-
```
77-
import org.eclipse.paho.client.mqttv3.MqttClient;
78-
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
79-
import org.eclipse.paho.client.mqttv3.MqttException;
80-
import org.eclipse.paho.client.mqttv3.MqttMessage;
81-
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
82-
83-
public class MqttPublishSample {
84-
85-
public static void main(String[] args) {
86-
87-
String topic = "MQTT Examples";
88-
String content = "Message from MqttPublishSample";
89-
int qos = 2;
90-
String broker = "tcp://iot.eclipse.org:1883";
91-
String clientId = "JavaSample";
92-
MemoryPersistence persistence = new MemoryPersistence();
93-
94-
try {
95-
MqttClient sampleClient = new MqttClient(broker, clientId, persistence);
96-
MqttConnectOptions connOpts = new MqttConnectOptions();
97-
connOpts.setCleanSession(true);
98-
System.out.println("Connecting to broker: "+broker);
99-
sampleClient.connect(connOpts);
100-
System.out.println("Connected");
101-
System.out.println("Publishing message: "+content);
102-
MqttMessage message = new MqttMessage(content.getBytes());
103-
message.setQos(qos);
104-
sampleClient.publish(topic, message);
105-
System.out.println("Message published");
106-
sampleClient.disconnect();
107-
System.out.println("Disconnected");
108-
System.exit(0);
109-
} catch(MqttException me) {
110-
System.out.println("reason "+me.getReasonCode());
111-
System.out.println("msg "+me.getMessage());
112-
System.out.println("loc "+me.getLocalizedMessage());
113-
System.out.println("cause "+me.getCause());
114-
System.out.println("excep "+me);
115-
me.printStackTrace();
116-
}
117-
}
118-
}
119-
```
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?xml version="1.0"?>
2+
<project
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4+
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>org.eclipse.paho</groupId>
9+
<artifactId>java-parent</artifactId>
10+
<version>0.0.1-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>org.eclipse.paho.mqttv5.client</artifactId>
14+
<name>org.eclipse.paho.mqttv5.client</name>
15+
16+
<repositories>
17+
<repository>
18+
<id>OSGi Snapshots</id>
19+
<url>https://oss.sonatype.org/content/groups/osgi</url>
20+
<releases>
21+
<enabled>false</enabled>
22+
</releases>
23+
<snapshots>
24+
<enabled>true</enabled>
25+
</snapshots>
26+
</repository>
27+
</repositories>
28+
29+
30+
<dependencies>
31+
<dependency>
32+
<groupId>org.osgi</groupId>
33+
<artifactId>org.osgi.util.promise</artifactId>
34+
<version>1.1.0-SNAPSHOT</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.osgi</groupId>
38+
<artifactId>org.osgi.util.function</artifactId>
39+
<version>1.1.0-SNAPSHOT</version>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.osgi</groupId>
43+
<artifactId>org.osgi.util.pushstream</artifactId>
44+
<version>1.0.0-SNAPSHOT</version>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.eclipse.paho</groupId>
48+
<artifactId>org.eclipse.paho.mqttv5.common</artifactId>
49+
<version>0.0.1-SNAPSHOT</version>
50+
</dependency>
51+
</dependencies>
52+
53+
<build>
54+
<plugins>
55+
<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-compiler-plugin</artifactId>
58+
<version>3.6.0</version>
59+
<configuration>
60+
<source>1.8</source>
61+
<target>1.8</target>
62+
</configuration>
63+
</plugin>
64+
<plugin>
65+
<groupId>org.apache.maven.plugins</groupId>
66+
<artifactId>maven-javadoc-plugin</artifactId>
67+
<version>2.10.4</version>
68+
<executions>
69+
<execution>
70+
<id>attach-javadocs</id>
71+
<goals>
72+
<goal>javadoc-no-fork</goal>
73+
<goal>jar</goal>
74+
</goals>
75+
<configuration>
76+
<additionalparam>${javadoc.opts}</additionalparam>
77+
</configuration>
78+
</execution>
79+
</executions>
80+
</plugin>
81+
82+
<plugin>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-shade-plugin</artifactId>
85+
<version>1.4</version>
86+
<executions>
87+
<execution>
88+
<phase>package</phase>
89+
<goals>
90+
<goal>shade</goal>
91+
</goals>
92+
<configuration>
93+
<transformers>
94+
<transformer
95+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
96+
</transformer>
97+
</transformers>
98+
</configuration>
99+
</execution>
100+
</executions>
101+
</plugin>
102+
<plugin>
103+
<groupId>org.apache.maven.plugins</groupId>
104+
<artifactId>maven-failsafe-plugin</artifactId>
105+
<version>2.20</version>
106+
<executions>
107+
<execution>
108+
<id>integration-test</id>
109+
<goals>
110+
<goal>integration-test</goal>
111+
</goals>
112+
</execution>
113+
<execution>
114+
<id>verify</id>
115+
<goals>
116+
<goal>verify</goal>
117+
</goals>
118+
</execution>
119+
</executions>
120+
</plugin>
121+
</plugins>
122+
</build>
123+
</project>

0 commit comments

Comments
 (0)