Apama Documentation : Connecting Apama Applications to External Components : Standard Connectivity Plug-ins : The MQTT Transport Connectivity Plug-in : Using MQTT connectivity from EPL
Using MQTT connectivity from EPL
The MQTT transport can either subscribe to or send to a particular topic, depending on whether your EPL is subscribing to or sending to a particular channel.
In EPL, in order to receive an MQTT message, you just need to subscribe to an MQTT topic with the appropriate prefix. For example:
monitor.subscribe("mqtt:topic_a");
on all A() as a {
print a.toString();
}
To send an Apama event to the MQTT broker, you just need to use the send...to statement to deliver the event to the MQTT topic. For example:
send A("hello world") to "mqtt:topic_a";
As with all connectivity plug-ins, the EPL application is responsible for telling the system when it is ready to start receiving events with onApplicationInitialized. See also Sending and receiving events with connectivity plug-ins.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback