To work with Mqtt, Mqtt Message broker/server required.
Mosquitto (http://mosquitto.org/) is an open source Mqtt Broker
In ubuntu mosquitto can be installed using the command $ sudo apt-get install mosquitto
Eclipse paho project provides Java library for Mqtt Client http://www.eclipse.org/paho/
Example Java code for Mqtt Publisher and Subscriber can be found here
https://bitbucket.org/mkjinesh/mqttclient
Usage: MQTTWordCount <MqttbrokerUrl> <topic>
<MqttbrokerUrl> and <topic> describe where Mqtt publisher is running.
To run this example locally, you may run publisher as
$ bin/run-example \
org.apache.spark.examples.streaming.MQTTPublisher tcp://localhost:1883 foo
and run the example as
$ bin/run-example \
org.apache.spark.examples.streaming.MQTTWordCount tcp://localhost:1883 foo
A sample wordcount with MqttStream stream
To work with Mqtt, Mqtt Message broker/server required. Mosquitto (http://mosquitto.org/) is an open source Mqtt Broker In ubuntu mosquitto can be installed using the command
$ sudo apt-get install mosquitto
Eclipse paho project provides Java library for Mqtt Client http://www.eclipse.org/paho/ Example Java code for Mqtt Publisher and Subscriber can be found here https://bitbucket.org/mkjinesh/mqttclient Usage: MQTTWordCount <MqttbrokerUrl> <topic> <MqttbrokerUrl> and <topic> describe where Mqtt publisher is running.To run this example locally, you may run publisher as
$ bin/run-example \ org.apache.spark.examples.streaming.MQTTPublisher tcp://localhost:1883 foo
and run the example as$ bin/run-example \ org.apache.spark.examples.streaming.MQTTWordCount tcp://localhost:1883 foo