Fixes
3 files changed
tree: 2f64dd86afa0c014db098a32282fad9b679709a3
  1. rcomp-api/
  2. rcomp-eventadmin/
  3. rcomp-examples/
  4. rcomp-index/
  5. rcomp-mail/
  6. rcomp-mqtt/
  7. .gitignore
  8. LICENSE
  9. pom.xml
  10. README.md
README.md

Prototype of messaging components and reactive streams

Example for combining reactor and mqtt

The example MqttExampleComponent receives Integers from the topic “input”, computes the average over a sliding window of 2 elements and writes the results to the topic “output”.

This example show how to combine reactor with an protocols in a loosely coupled way that does not strictly couple your user code to the protocol.

Build

mvn clean install

Environment

Install and start a MQTT server. I recommend using mosquitto. You also need a MQTT client.

Install

feature:install scr
config:property-set -p component.mqtt.MqttComponent serverUrl tcp://localhost:1883
install -s mvn:org.eclipse.paho/org.eclipse.paho.client.mqttv3/1.1.1
install -s mvn:org.reactivestreams/reactive-streams/1.0.0
install -s mvn:io.projectreactor/reactor-core/3.0.7.RELEASE
install -s wrap:mvn:io.projectreactor.addons/reactor-extra/3.0.7.RELEASE
install -s mvn:javax.mail/mail/1.5.0-b01

install -s mvn:net.lr.reactive.component/rcomp-api/1.0.0-SNAPSHOT
install -s mvn:net.lr.reactive.component/rcomp-mqtt/1.0.0-SNAPSHOT
install -s mvn:net.lr.reactive.component/rcomp-eventadmin/1.0.0-SNAPSHOT
install -s mvn:net.lr.reactive.component/rcomp-examples/1.0.0-SNAPSHOT

Test

Mqtt

Start mqtt client

Subscribe to topic “output”. Send two messages containing the values “1”, “2” and “3” to the topic “input”.

You should receive the following on the topic output: “1.5”, “2.5”

EventAdmin

event:send input a=b
log:tail

The log should show that the event was received.