Apama 10.15.0 | Connecting Apama Applications to External Components | Correlator-Integrated Support for the Java Message Service (JMS) | Using the Java Message Service (JMS) | Dynamic senders and receivers
 
Dynamic senders and receivers
In addition to specifying static senders and receivers in the adapter's configuration file as introduced in Getting started with simple correlator-integrated messaging for JMS, you can dynamically add and manage senders and receivers using actions on Apama's JMSConnection event. (Note, for more information on static senders and receivers, see Adding static senders and receivers.)
The unique identifiers specified when adding dynamic senders or receivers must not clash with the identifiers used for any static senders and receivers in the configuration file. You cannot dynamically remove a sender or receiver that was defined statically in the configuration file; only dynamically added senders and receivers can be removed.
It is currently valid to send events to the channel associated with a newly created dynamic sender as soon as the add action has returned. In this case, the correlator ensures that the events get sent to the JMS broker eventually. However, best practice is to add a listener for JMSSenderStatus events and wait for the OK status before beginning to send to a dynamic sender. It is valid to send events to an existing sender's channel at any point until its removal is requested by calling the remove() action. It is not valid to send any events to that channel after remove() has been called, and any events sent after this point are in doubt and could be ignored without any error being logged. Applications that make use of multiple contexts may need to coordinate across contexts to ensure that no send or other operations are performed on senders that have been removed in another context.
For more information on dynamically adding senders and receivers, see the JMSConnection event documentation in the ApamaDoc documentation.
The example Apama application located in the APAMA_HOME\samples\correlator_jms\dynamic-event-api directory demonstrates how to use the event API to dynamically add and remove JMS senders and receivers. In addition, it shows how to monitor senders and receivers for errors and availability.