<commit_before># Simple MQTT Client in Java [![Build Status](https://travis-ci.org/ltg-uic/simple-java-mqtt-client.svg?branch=master)](https://travis-ci.org/ltg-uic/simple-java-mqtt-client)
A simple asynchronous MQTT client written in Java.  

## Download
You can either download the zip file from the releases on Github [here](https://github.com/ltg-uic/simple-java-mqtt-client/releases) or use Maven. If you are using Maven, add the following to your project `pom.xml` file.
```xml
<project ...>
...
<repositories>
    <repository>
        <id>LTG</id>
        <url>http://ltg.evl.uic.edu/artifactory/repo</url>
    </repository>
</repositories>
...
<dependencies>
    <dependency>
        <groupId>ltg</groupId>
        <artifactId>simple-java-mqtt-client</artifactId>
        <version>1.0.0</version>
    </dependency>
</dependencies>
...
</project>
```

## Hello world
```java
import ltg.commons.SimpleMQTTClient;

public class MQTTClientDemo {

	public static void main(String[] args) {
    // Create a new client and connect to a broker
		SimpleMQTTClient sc = new SimpleMQTTClient("localhost", "test-bot");

    // Subscribe to a channel and register a callback for it
    sc.subscribe("myChannel", message -> System.out.println(message));
    
    // Do something...
    
    // Publish to a channel
    sc.publish("myOtherChannel", "A message from me");
    
    // Do something else...
    
    // Unsubscribe from a channel
    sc.unsubscribe("myChannel");<commit_msg>Fixed example in readme<commit_after># Simple MQTT Client in Java [![Build Status](https://travis-ci.org/ltg-uic/simple-java-mqtt-client.svg?branch=master)](https://travis-ci.org/ltg-uic/simple-java-mqtt-client)
A simple asynchronous MQTT client written in Java.  

## Download
You can either download the zip file from the releases on Github [here](https://github.com/ltg-uic/simple-java-mqtt-client/releases) or use Maven. If you are using Maven, add the following to your project `pom.xml` file.
```xml
<project ...>
...
<repositories>
    <repository>
        <id>LTG</id>
        <url>http://ltg.evl.uic.edu/artifactory/repo</url>
    </repository>
</repositories>
...
<dependencies>
    <dependency>
        <groupId>ltg</groupId>
        <artifactId>simple-java-mqtt-client</artifactId>
        <version>1.0.0</version>
    </dependency>
</dependencies>
...
</project>
```

## Hello world
```java
import ltg.commons.SimpleMQTTClient;

public class MQTTClientDemo {

	public static void main(String[] args) {
    // Create a new client and connect to a broker
		SimpleMQTTClient sc = new SimpleMQTTClient("localhost", "test-bot");

    // Subscribe to a channel and register a callback for it
    sc.subscribe("myChannel", new MessageListener() {
      @Override
      public void processMessage(String message) {
        System.out.println(message);
      }
    });
    
    // Do something...
    
    // Publish to a channel
    sc.publish("myOtherChannel", "A message from me");
    
    // Do something else...
    
    // Unsubscribe from a channel
    sc.unsubscribe("myChannel");
{'fraction_non_alphanumeric': 0.14123006833712984, 'fraction_numerical': 0.0019524894240156199, 'mean_word_length': 3.0877659574468086, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 44, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6828277', 'n_tokens_mistral': 1007, 'n_tokens_neox': 958, 'n_words': 250}