Apama 10.15.0 | Connecting Apama Applications to External Components | Working with Connectivity Plug-ins | Getting Started with Connectivity Plug-ins | Writing EPL
 
Writing EPL
After you have edited the properties file for the connectivity plug-in (and maybe also the YAML configuration file), you have to write some EPL to cover the following main steps:
*Define the Apama event types for the messages you wish to send or receive.
*Use monitor.subscribe to subscribe to the correlator channel(s) from which you wish to receive messages from the transport. Add an event listener for these events, perhaps logging the incoming events to check that everything is working.
*Send events to any correlator channels to which the connectivity chain is subscribed. Keep in mind that the channel names depend on the transport and how it is configured.
*Call ConnectivityPlugins.onApplicationInitialized once your EPL is ready to receive incoming messages.
For simple applications, this can be done in the onload() action.
For real applications, we recommend the following:
1. Define an event to indicate when the application is fully injected.
2. Send that event by providing an event (.evt) file, which is always sent by default after all EPL has been injected.
3. Call ConnectivityPlugins.onApplicationInitialized once that event has been received.
*If your transport does not have a dynamic chain manager and you wish to create chains dynamically from EPL (rather than statically in YAML), you also have to create those chains using com.softwareag.connectivity.ConnectivityPlugins.createDynamicChain.
Note: 
If you use the genericsendreceive sample as recommended in Adding the connectivity bundles, all required EPL code is already available in the SendReceiveSample.mon file.