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.