Apama 10.15.0 | Connecting Apama Applications to External Components | Standard Connectivity Plug-ins | The MQTT Transport Connectivity Plug-in | Mapping events between MQTT messages and EPL
 
Mapping events between MQTT messages and EPL
You can use the apama.eventMap host plug-in in a dynamic chain to translate events to or from nested messages like JSON data. You configure exactly one dynamicChains section to handle transforming messages from the MQTT broker into the correlator, and vice versa.
The following description shows how to configure the genericsendreceive sample to send/receive data to/from an MQTT broker. The advantage of this sample is that all required EPL code is already available (see also Writing EPL). The sample is located in the samples/connectivity_plugin/application/genericsendreceive directory of your Apama installation. To use the sample, do the following:
1. Import the sample into Software AG Designer as an existing project (make sure to create a copy).
2. Add the MQTT connectivity plug-in to that project (see also Adding the MQTT connectivity plug-in to a project) and edit the MQTT.yaml file as per your application.
3. Configure both the input and output channels to apamax by sending the ConfigureSample event (in order to send continuous data, keepSending must be set to true).
4. Send the AppReady event to start the application.
We recommend use of the suppressLoopback configuration property to prevent undesirable behavior. See Host plug-ins and configuration for further information.