Skip to content

Commit c05461b

Browse files
author
Ranjan Dasgupta
authored
Merge branch 'develop' into PropertiesToMap502
2 parents 9920fe4 + 0941287 commit c05461b

405 files changed

Lines changed: 10021 additions & 6495 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.

.github/ISSUE_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Please fill out the form below before submitting, thank you!
2+
3+
- [ ] Bug exists Release Version 1.2.5 ( Master Branch)
4+
- [ ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
5+
- [ ] Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
6+
7+
8+
If this is a bug regarding the Android Service, please raise the bug here instead: https://github.com/eclipse/paho.mqtt.android/issues/new

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Please make sure that the following boxes are checked before submitting your Pull Request, thank you!
2+
3+
- [ ] This change is against the develop branch, **not** master.
4+
- [ ] You have signed the [Eclipse ECA](https://wiki.eclipse.org/ECA)
5+
- [ ] All of your commits have been signed-off with the correct email address (the same one that you
6+
used to sign the CLA) _Hint: use the -s argument when committing_.
7+
- [ ] If This PR fixes an issue, that you reference the issue below. OR if this is a new issue that
8+
you are fixing straight away that you add some Description about the bug and how this will fix it.
9+
- [ ] If this is new functionality, You have added the appropriate Unit tests.

.github/workflows/main.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Workflow to build mqtt.paho.java library
2+
3+
name: Java CI
4+
5+
on:
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
branches: [ master ]
10+
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
# os: [ubuntu-latest, macOS-latest, windows-latest]
19+
# java: [ 8.0.192, 8, 11.0.3, 17, 18-ea ]
20+
os: [ubuntu-latest]
21+
java: [ 8.0.192 ]
22+
fail-fast: false
23+
max-parallel: 4
24+
name: Build MQTT Paho Java on JDK ${{ matrix.java }}, ${{ matrix.os }}
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set up JDK ${{ matrix.java }} ${{ matrix.os }}
28+
uses: actions/setup-java@v1
29+
with:
30+
java-version: ${{ matrix.java }}
31+
java-package: jdk
32+
- name: Package with Maven skip tests
33+
run: mvn -B package --file pom.xml -DskipTests
34+

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,10 @@ target/
6262

6363

6464
*.log.*
65+
66+
# Test files
67+
Bug443142Test-*-tcplocalhost*
68+
client-1-tcpioteclipseorg1882
69+
testConnectTimeout
70+
71+

.travis.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
1-
sudo: true
1+
sudo: required
22
language: java
33
install: true
4-
matrix:
4+
5+
jobs:
56
include:
67
- os: linux
78
dist: trusty
8-
sudo: required
9-
# - os: osx
10-
11-
sudo: required
9+
jdk: oraclejdk8
1210

1311
before_install:
1412
- ./start-broker.sh
1513

1614
script:
1715
- mvn -B clean -q
1816
- mvn -B --projects org.eclipse.paho.client.mqttv3,org.eclipse.paho.client.mqttv3.test test -q
19-
- mvn -B --projects org.eclipse.paho.mqttv5.common,org.eclipse.paho.mqttv5.client test -q
17+
- mvn -B --projects org.eclipse.paho.mqttv5.client,org.eclipse.paho.mqttv5.client.test test -q
2018

21-
#addons:
22-
# apt:
23-
# sources:
24-
# - sourceline: 'ppa:mosquitto-dev/mosquitto-ppa'
25-
# packages:
26-
# - mosquitto

CODE_OF_CONDUCT.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Community Code of Conduct
2+
3+
## Our Pledge
4+
5+
As members of the Eclipse community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting code reviews, pull requests, patches, and other activities.
6+
7+
## Our Standards
8+
9+
We are committed to making participation in the Eclipse community a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion or analogous grounds.
10+
11+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
12+
13+
## Our Responsibilities
14+
15+
Eclipse Foundation staff have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project leaders, committers and contributors who do not follow the Code of Conduct may be removed from the project.
16+
17+
## Scope
18+
19+
This code of conduct applies within Eclipse project spaces, or in public spaces when an individual is representing the project or the Eclipse community.
20+
21+
## Enforcement
22+
23+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by emailing the Eclipse Management Organization: codeofconduct@eclipse.org.
24+
25+
## Attribution
26+
27+
This Code of Conduct is adapted from the Contributor Covenant (http://contributor-covenant.org), version 1.1.0, available at http://contributor-covenant.org/version/1/1/0/
28+
29+
The Eclipse Code Of Conduct can also be viewed [here](https://eclipse.org/org/documents/Community_Code_of_Conduct.php).

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ In order for your contribution to be accepted, it must comply with the Eclipse F
1010

1111
Please read the [Eclipse Foundation policy on accepting contributions via Git](http://wiki.eclipse.org/Development_Resources/Contributing_via_Git).
1212

13-
1. Sign the [Eclipse CLA](http://www.eclipse.org/legal/CLA.php)
13+
1. Sign the [Eclipse ECA](http://www.eclipse.org/legal/ECA.php)
1414
1. Register for an Eclipse Foundation User ID. You can register [here](https://dev.eclipse.org/site_login/createaccount.php).
15-
2. Log into the [Projects Portal](https://projects.eclipse.org/), and click on the '[Eclipse CLA](https://projects.eclipse.org/user/sign/cla)' link.
15+
2. Log into the [Eclipse projects forge](https://www.eclipse.org/contribute/cla), and click on 'Eclipse Contributor Agreement'.
1616
2. Go to your [account settings](https://dev.eclipse.org/site_login/myaccount.php#open_tab_accountsettings) and add your GitHub username to your account.
1717
3. Make sure that you _sign-off_ your Git commits in the following format:
18-
``` Signed-off-by: John Smith <johnsmith@nowhere.com> ``` This is usually at the bottom of the commit message. You can automate this by adding the '-s' flag when you make the commits. e.g. ```git commit -s -m "Adding a cool feature"```
18+
``` Signed-off-by: Alex Smith <alexsmith@nowhere.com> ``` This is usually at the bottom of the commit message. You can automate this by adding the '-s' flag when you make the commits. e.g. ```git commit -s -m "Adding a cool feature"```
1919
4. Ensure that the email address that you make your commits with is the same one you used to sign up to the Eclipse Foundation website with.
2020

2121
## Contributing a change

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Eclipse Public License - v 2.0
2+
3+
This program and the accompanying materials
4+
are made available under the terms of the Eclipse Public License v2.0
5+
and Eclipse Distribution License v1.0 which accompany this distribution.
6+
7+
The Eclipse Public License is available at
8+
https://www.eclipse.org/legal/epl-2.0/
9+
and the Eclipse Distribution License is available at
10+
https://www.eclipse.org/org/documents/edl-v10.php
11+
12+
For an explanation of what dual-licensing means to you, see:
13+
https://www.eclipse.org/legal/eplfaq.php#DUALLIC

MQTTv3.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Eclipse hosts a Nexus repository for those who want to use Maven to manage their
1111
Add the repository definition and the dependency definition shown below to your pom.xml.
1212

1313
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```.
14+
15+
The latest release version is ```1.2.5``` and the current snapshot version is ```1.2.6-SNAPSHOT```.
1516

1617
```
1718
<project ...>
@@ -114,4 +115,4 @@ connectOptions.setCustomWebSocketHeaders(properties);
114115
115116
client.connect(connectOptions);
116117
117-
```
118+
```

MQTTv5.md

Lines changed: 94 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,105 @@
11
# Eclipse Paho Java Client for MQTTv5
22

3-
_Warning: The Paho MQTTv5 client is under active development and so can expect breaking changes whilst in the develop branch._
3+
The v5 client is build on the same foundations as the v3 client is, however it is being heavily refactored using lessons learnt from the v3 client and feedback from the community. Like v3 client, 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.
44

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.
5+
## Using the Paho Java MQTTv5 Client
66

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.
7+
### Downloading
88

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.
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.
1010

11-
## Plan
11+
Add the repository definition and the dependency definition shown below to your pom.xml.
1212

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.
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 .
1814

19-
## Help, something doesn't work! / This looks terrible! / What about x!
15+
The latest release version is ```1.2.5``` and the current snapshot version is ```1.2.6-SNAPSHOT```.
2016

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.
17+
```
18+
<project ...>
19+
<repositories>
20+
<repository>
21+
<id>Eclipse Paho Repo</id>
22+
<url>%REPOURL%</url>
23+
</repository>
24+
</repositories>
25+
...
26+
<dependencies>
27+
<dependency>
28+
<groupId>org.eclipse.paho</groupId>
29+
<artifactId>org.eclipse.paho.mqttv5.client</artifactId>
30+
<version>%VERSION%</version>
31+
</dependency>
32+
</dependencies>
33+
</project>
2234
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.
35+
```
36+
37+
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.
38+
39+
### Building from source
40+
41+
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 ```
42+
43+
To then build the library run the following maven command: ```mvn package -DskipTests```
44+
45+
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.mqttv5.client/target``` directory.
46+
47+
## Documentation
48+
Reference documentation is online at: [http://www.eclipse.org/paho/files/javadoc/index.html](http://www.eclipse.org/paho/files/javadoc/index.html)
49+
50+
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)
51+
52+
## Getting Started
53+
54+
The included code below is a very basic sample that connects to a server and publishes a message using the MqttClient asynchronous API. More extensive samples demonstrating the use of the Asynchronous API will be added in the ```org.eclipse.paho.sample.mqttv5app``` directory of the source soon.
55+
56+
57+
```
58+
import org.eclipse.paho.mqttv5.client.MqttAsyncClient;
59+
import org.eclipse.paho.mqttv5.client.MqttConnectionOptions;
60+
import org.eclipse.paho.mqttv5.client.IMqttToken;
61+
import org.eclipse.paho.mqttv5.client.persist.MemoryPersistence;
62+
import org.eclipse.paho.mqttv5.common.MqttException;
63+
import org.eclipse.paho.mqttv5.common.MqttMessage;
64+
import org.eclipse.paho.mqttv5.common.packet.MqttProperties;
65+
66+
public class MqttPublishSample {
67+
68+
public static void main(String[] args) {
69+
70+
String topic = "MQTT Examples";
71+
String content = "Message from MqttPublishSample";
72+
int qos = 2;
73+
String broker = "tcp://iot.eclipse.org:1883";
74+
String clientId = "JavaSample";
75+
MemoryPersistence persistence = new MemoryPersistence();
76+
77+
try {
78+
MqttConnectionOptions connOpts = new MqttConnectionOptions();
79+
connOpts.setCleanStart(false);
80+
MqttAsyncClient sampleClient = new MqttAsyncClient(broker, clientId, persistence);
81+
System.out.println("Connecting to broker: " + broker);
82+
IMqttToken token = sampleClient.connect(connOpts);
83+
token.waitForCompletion();
84+
System.out.println("Connected");
85+
System.out.println("Publishing message: "+content);
86+
MqttMessage message = new MqttMessage(content.getBytes());
87+
message.setQos(qos);
88+
token = sampleClient.publish(topic, message);
89+
token.waitForCompletion();
90+
System.out.println("Disconnected");
91+
System.out.println("Close client.");
92+
sampleClient.close();
93+
System.exit(0);
94+
} catch(MqttException me) {
95+
System.out.println("reason "+me.getReasonCode());
96+
System.out.println("msg "+me.getMessage());
97+
System.out.println("loc "+me.getLocalizedMessage());
98+
System.out.println("cause "+me.getCause());
99+
System.out.println("excep "+me);
100+
me.printStackTrace();
101+
}
102+
}
103+
}
104+
```
24105

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!

0 commit comments

Comments
 (0)