Skip to content

Commit eafef67

Browse files
committed
Merge pull request #11 from jpwsutton/master
Adding updated README & CONTRIBUTING to master branch
2 parents d042903 + 408c681 commit eafef67

2 files changed

Lines changed: 138 additions & 69 deletions

File tree

CONTRIBUTING.md

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,68 @@
1-
Contributing to Paho
2-
====================
1+
# Contributing to Paho
32

4-
Thanks for your interest in this project.
3+
Thanks for your interest in this project!
54

6-
Project description:
7-
--------------------
5+
You can contribute bugfixes and new features by sending pull requests through GitHub.
86

9-
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).
10-
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.
7+
## Legal
118

12-
- [Project web site](https://www.eclipse.org/paho)
13-
- [Project information](https://projects.eclipse.org/projects/iot.paho)
9+
In order for your contribution to be accepted, it must comply with the Eclipse Foundation IP policy.
1410

15-
Source
16-
------
11+
Please read the [Eclipse Foundation policy on accepting contributions via Git](http://wiki.eclipse.org/Development_Resources/Contributing_via_Git).
1712

18-
The Paho Java client and Android service are stored in a git repository. The URLs to access it are:
13+
1. Sign the [Eclipse CLA](http://www.eclipse.org/legal/CLA.php)
14+
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.
16+
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.
17+
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"```
19+
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.
1920

20-
ssh://<username>@git.eclipse.org:29418/paho/org.eclipse.paho.mqtt.java
21-
https://<username>@git.eclipse.org/r/paho/org.eclipse.paho.mqtt.java
21+
## Contributing a change
2222

23-
A [web browsable repository](http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git) is available.
23+
## Contributing a change
2424

25-
Contributing a patch
26-
--------------------
25+
1. [Fork the repository on GitHub](https://github.com/eclipse/paho.mqtt.java/fork)
26+
2. Clone the forked repository onto your computer: ``` git clone https://github.com/<your username>/paho.mqtt.java.git ```
27+
3. Create a new branch from the latest ```develop``` branch with ```git checkout -b YOUR_BRANCH_NAME origin/develop```
28+
4. Make your changes
29+
5. If developing a new feature, make sure to include JUnit tests.
30+
6. Ensure that all new and existing tests pass.
31+
7. Commit the changes into the branch: ``` git commit -s ``` Make sure that your commit message is meaningful and describes your changes correctly.
32+
8. If you have a lot of commits for the change, squash them into a single / few commits.
33+
9. Push the changes in your branch to your forked repository.
34+
10. Finally, go to [https://github.com/eclipse/paho.mqtt.java](https://github.com/eclipse/paho.mqtt.java) and create a pull request from your "YOUR_BRANCH_NAME" branch to the ```develop``` one to request review and merge of the commits in your pushed branch.
2735

28-
The Paho repositories are accessed through Gerrit, the code review
29-
project, which makes it possible for anybody to clone the repository, make
30-
changes and push them back for review and eventual acceptance into the project.
31-
32-
To do this, you must follow a few steps. The first of these are described at
33-
34-
- [Contributing via git](https://wiki.eclipse.org/Development_Resources/Contributing_via_Git)
35-
36-
* Sign the Eclipse CLA
37-
* Use a valid commit record, including a signed-off-by entry.
38-
39-
There are further details at
40-
41-
- [Handling Git Contributions](https://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions)
42-
43-
Once the patch is pushed back to Gerrit, the project committers will be
44-
informed and they will undertake a review of the code. The patch may need
45-
modifying for some reason. In order to make amending commits more
46-
straightforward, the steps at
47-
https://git.eclipse.org/r/Documentation/cmd-hook-commit-msg.html should be
48-
followed. This automatically inserts a "Change-Id" entry to your commit message
49-
which allows you to amend commits and have Gerrit track them as the same
50-
change.
5136

5237
What happens next depends on the content of the patch. If it is 100% authored
5338
by the contributor and is less than 1000 lines (and meets the needs of the
54-
project), then it can be committed to the main repository. If not, more steps
55-
are required. These are detailed in the
39+
project), then it can be pulled into the main repository. If not, more steps
40+
are required. These are detailed in the
5641
[legal process poster](http://www.eclipse.org/legal/EclipseLegalProcessPoster.pdf).
5742

5843

59-
Developer resources:
60-
--------------------
6144

62-
Information regarding source code management, builds, coding standards, and more.
45+
## Developer resources:
6346

64-
- [https://projects.eclipse.org/projects/iot.paho/developer](https://projects.eclipse.org/projects/iot.paho/developer)
6547

66-
Contributor License Agreement:
67-
------------------------------
48+
Information regarding source code management, builds, coding standards, and more.
6849

69-
Before your contribution can be accepted by the project, you need to create and electronically sign the Eclipse Foundation [Contributor License Agreement (CLA)](http://www.eclipse.org/legal/CLA.php).
50+
- [https://projects.eclipse.org/projects/iot.paho/developer](https://projects.eclipse.org/projects/iot.paho/developer)
7051

7152
Contact:
7253
--------
7354

74-
Contact the project developers via the project's development
55+
Contact the project developers via the project's development
7556
[mailing list](https://dev.eclipse.org/mailman/listinfo/paho-dev).
7657

7758
Search for bugs:
7859
----------------
7960

80-
This project uses [Bugzilla](https://bugs.eclipse.org/bugs/buglist.cgi?product=Paho) to track ongoing development and issues.
61+
This project currently uses [Bugzilla](https://bugs.eclipse.org/bugs/buglist.cgi?product=Paho) to track ongoing development and issues.
8162

8263
Create a new bug:
8364
-----------------
8465

8566
Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!
8667

87-
- [Create new Paho bug](https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Paho)
68+
- [Create new Paho bug](https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Paho)

README.md

Lines changed: 105 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,118 @@
1-
Paho Java client for MQTT
1+
# Eclipse Paho Java Client
22

3-
This is to be completed... (Ian Craggs)
3+
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
44

5+
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.
56

6-
Updating to a new version number
7-
-------------------------------
87

9-
Ok. There are some Maven commands to update releases, but so far I've not been able to determine what those should be.
8+
## Project description:
109

11-
In the develop branch, we want the releases to be the vNext-SNAPSHOT
10+
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).
11+
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.
1212

13-
But in the master branch, we want
1413

14+
## Links
1515

16-
Maven command to update versions:
16+
- Project Website: [https://www.eclipse.org/paho](https://www.eclipse.org/paho)
17+
- Eclipse Project Information: [https://projects.eclipse.org/projects/iot.paho](https://projects.eclipse.org/projects/iot.paho)
18+
- Paho Java Client Page: [https://eclipse.org/paho/clients/java/](https://eclipse.org/paho/clients/java)
19+
- GitHub: [https://github.com/eclipse/paho.mqtt.java](https://github.com/eclipse/paho.mqtt.java)
20+
- Twitter: [@eclipsepaho](https://twitter.com/eclipsepaho)
21+
- Issues: Currently [https://bugs.eclipse.org/bugs/buglist.cgi?component=MQTT-Java](https://bugs.eclipse.org/bugs/buglist.cgi?component=MQTT-Java), though will soon be GitHub Issues.
22+
- Mailing-list: [https://dev.eclipse.org/mailman/listinfo/paho-dev](https://dev.eclipse.org/mailman/listinfo/paho-dev)
1723

18-
mvn versions:set -DnewVersion=1.0.2-SNAPSHOT
24+
## Using the Paho Java Client
1925

20-
this will work for pom.xml files. However we have OSGi manifests as well. Linux commands to update versions:
26+
### Downloading
2127

22-
find | grep "MANIFEST\.MF" | xargs sed -i "s/1\.0\.2/1\.0\.3\.qualifier/g"
23-
find | grep "feature.xml" | xargs sed -i "s/1\.0\.2/1\.0\.3\.qualifier/g"
24-
find | grep "build.xml" | xargs sed -i "s/1\.0\.2/1\.0\.3\.qualifier/g"
25-
find | grep "category.xml" | xargs sed -i "s/1\.0\.2/1\.0\.3\.qualifier/g"
26-
find | grep "ui.app.product" | xargs sed -i "s/1\.0\.2/1\.0\.3\.qualifier/g"
28+
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.
2729

28-
Example Linux command to find all files with instances of a version number:
30+
Add the repository definition and the dependency definition shown below to your pom.xml.
2931

30-
find | xargs grep -s "1\.0\.2"
32+
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 .
33+
The latest release version is ```1.0.2``` and the current snapshot version is ```1.0.3```.
34+
35+
```
36+
<project ...>
37+
<repositories>
38+
<repository>
39+
<id>Eclipse Paho Repo</id>
40+
<url>%REPOURL%</url>
41+
</repository>
42+
</repositories>
43+
...
44+
<dependencies>
45+
<dependency>
46+
<groupId>org.eclipse.paho</groupId>
47+
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
48+
<version>%VERSION%</version>
49+
</dependency>
50+
</dependencies>
51+
</project>
52+
53+
```
54+
55+
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.
56+
57+
### Building from source
58+
59+
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 ```
60+
61+
To then build the library run the following maven command: ```mvn package -DskipTests```
62+
63+
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.
64+
65+
## Documentation
66+
Reference documentation is online at: [http://www.eclipse.org/paho/files/javadoc/index.html](http://www.eclipse.org/paho/files/javadoc/index.html)
67+
68+
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)
69+
70+
## Getting Started
71+
72+
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.
73+
74+
75+
```
76+
import org.eclipse.paho.client.mqttv3.MqttClient;
77+
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
78+
import org.eclipse.paho.client.mqttv3.MqttException;
79+
import org.eclipse.paho.client.mqttv3.MqttMessage;
80+
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
81+
82+
public class MqttPublishSample {
83+
84+
public static void main(String[] args) {
85+
86+
String topic = "MQTT Examples";
87+
String content = "Message from MqttPublishSample";
88+
int qos = 2;
89+
String broker = "tcp://iot.eclipse.org:1883";
90+
String clientId = "JavaSample";
91+
MemoryPersistence persistence = new MemoryPersistence();
92+
93+
try {
94+
MqttClient sampleClient = new MqttClient(broker, clientId, persistence);
95+
MqttConnectOptions connOpts = new MqttConnectOptions();
96+
connOpts.setCleanSession(true);
97+
System.out.println("Connecting to broker: "+broker);
98+
sampleClient.connect(connOpts);
99+
System.out.println("Connected");
100+
System.out.println("Publishing message: "+content);
101+
MqttMessage message = new MqttMessage(content.getBytes());
102+
message.setQos(qos);
103+
sampleClient.publish(topic, message);
104+
System.out.println("Message published");
105+
sampleClient.disconnect();
106+
System.out.println("Disconnected");
107+
System.exit(0);
108+
} catch(MqttException me) {
109+
System.out.println("reason "+me.getReasonCode());
110+
System.out.println("msg "+me.getMessage());
111+
System.out.println("loc "+me.getLocalizedMessage());
112+
System.out.println("cause "+me.getCause());
113+
System.out.println("excep "+me);
114+
me.printStackTrace();
115+
}
116+
}
117+
}
118+
```

0 commit comments

Comments
 (0)