Dynamic senders and receivers
In addition to specifying static senders and receivers in the adapter's configuration file as introduced in
Getting started - creating an application 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 receive that was defined statically in the configuration file; only dynamically added senders and receivers can be removed.
It is currently valid to emit 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 and wait for the OK status before beginning to emit to a dynamic sender. It valid to emit 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 emit any events to that channel after remove() has been called, and any events emitted 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 co-ordinate across contexts to ensure that no emit 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_dir\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.