Deploying and Managing Apama Applications > Correlator-Integrated JMS Messaging > Mapping Apama events and JMS messages > Convention-based XML mapping > Using convention-based XML mapping when sending/generating messages
Using convention-based XML mapping when sending/generating messages
To map an Apama event to a JMS message using the convention-based approach:
1. Create an Apama event type with fields that correspond in type and order to the structure of the XML document. In order to use convention-based XML mapping, the event type representing the XML document must be nested inside a parent event type, so ensure that such a parent event type has been created. Typically the parent event type might have two fields, a string field representing the JMS destination, and an event field representing the root of the XML document.
2. In the adapter editor's Event Mappings tab, click the Add Event button ()to add a mapping for the desired parent event type (that is, the event type which contains the event field representing the XML root element).
3. In the adapter editor's Event Mappings tab, right-click the Apama event representing the root node of the XML document and select Add Computed Node. The Add Computed Node dialog is displayed.
4. In the Add Computed Node dialog's Select Method field, select Convert to XML from the drop-down list. The dialog is updated to show more information.
You can specify a namespace and namespace prefix for the generated XML document if desired, or else leave them blank. By default the Include empty fields option is enabled. This specifies that empty XML nodes will be generated when empty EPL string fields are encountered within an Apama event. This option does not affect empty strings within a sequence of EPL strings. If you clear the check box to disable the option, empty XML nodes will not be generated.
5. Click OK.
6. In the mapping tree, Apama Studio adds an entry of type Convert To XML to the selected event node.
7. Drag a mapping line from the eventToXml entry to the desired node in the XML message, for example, to the JMS Body.
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.