Getting started - creating an application with reliable JMS messaging
This section describes the steps for creating an Apama application that uses reliable correlator-integrated JMS messaging in an environment where guaranteed delivery is required. In order to provide reliable JMS messaging, you set specific JMS Connection properties. In addition, reliable JMS messaging makes use of Apama's correlator persistence feature, which specifies that the correlator periodically writes its state to stable storage.
The steps described in this section build on the example created in
Getting started - creating an application with simple JMS messagingTo enable reliable correlator-integrated JMS messaging for an Apama project:
2. If necessary, in the Project Explorer expand the project's Adapters node, expand the JMS Correlator-Integrated Adapter node, and double-click the adapter instance. This opens the instance's configuration in the JMS Correlator-Integrated Adapter editor.
3. In the adapter editor, display the Settings tab and in the JMS Connection section, select the JMS connection to use.
4. Click the Properties section to expand it.
5. In the Properties section, select EXACTLY_ONCE or AT_LEAST_ONCE for the Default receiver reliability and Default sender reliability properties. Both EXACTLY_ONCE and AT_LEAST_ONCE reliability modes prevent message loss, but while AT_LEAST_ONCE is simpler and offers greater performance, EXACTLY_ONCE adds detection and elimination of duplicate messages (if configured correctly) which may be required for some applications.
6. If receiving with EXACTLY_ONCE reliability, it is necessary to configure additional mapping rules to specify an application-level unique identifier for each received message that will function as the key for detecting functionally duplicate messages. To add these mapping rules, display the Event Mappings tab and in the source event tree, map the uniqueMessageId and (optionally, but recommended) messageSourceId entities to appropriate values in the JMS message. For example, they could be mapped to JMS message properties called UNIQUE_MESSAGE_ID and MESSAGE_SOURCE_ID (or to nodes within an XML document in the message body). When sending JMS messages, the mapping rules provide a way to expose the uniqueMessageId and messageSourceId that Apama automatically generates for emitted messages to whatever downstream JMS client will be receiving them, so that it can perform duplicate detection.
7. In your application's EPL code, add the persistent keyword before the monitor declarations for monitors listening for Apama events associated with JMS messages.
8. In the project's Run Configuration, enable correlator persistence as follows.
a. In the Run Configuration dialog, select the Components tab.
b. Select Default correlator and click Edit. The Correlator Configuration dialog is displayed.
c. In the Correlator Configuration dialog, select the Persistence Options tab, add a check mark (tick mark) to the Enable correlator persistence setting, and click OK.
Running a correlator in this way causes the it to periodically write its state to stable storage.
Copyright © 2013
Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.