Connecting Apama Applications to External Components > Using Message Services > Using Correlator-Integrated Messaging for JMS > Mapping Apama events and JMS messages > JUEL mapping expressions reference for JMS
JUEL mapping expressions reference for JMS
The expressions that can be used to get or set elements of a JMS message are listed below, along with the set of Apama field types that are recommended for use when mapping when sending or receiving JMS messages:
JMS message element
JMS EL expression
Compatible Apama field type(s) when sending
Compatible Apama field type(s) when receiving
Dictionary of all message headers
jms.headers
dictionary<string, string>
dictionary<string, string>
JMSDestination
jms.header[​'JMSDestination']
string (with jndi:/topic:/queue: prefix)
string (with topic:/queue: prefix)
JMSReplyTo
jms.header[​'JMSReplyTo']
string (with jndi:/topic:/queue: prefix)
string (with topic:/queue: prefix)
JMSCorrelationID
jms.header[​'JMSCorrelationID']
string
string
JMSType
jms.header[​'JMSType']
string
string
JMSPriority
jms.header[​'JMSPriority']
integer, string
integer, string
JMSDeliveryMode
jms.header[​'JMSDeliveryMode']
integer, string (must be a number (though display string can be used (only) when mapping a constant value in tooling); 1=NON_PERSISTENT, 2=PERSISTENT)
integer, string
JMSTimeToLive
jms.header[​'JMSTimeToLive']
integer, string (in milliseconds from the time JMS sends the message)
N/A when receiving
JMSExpiration
jms.header[​'JMSExpiration']
N/A when sending
integer, string (in milliseconds since the epoch)
JMSMessageID
jms.header[​'JMSMessageID']
N/A when sending
boolean, string
JMSTimestamp
jms.header[​'JMSTimestamp']
N/A when sending
integer, string (in milliseconds since the epoch)
JMSRedelivered
jms.header[​'JMSRedelivered']
N/A when sending
string
Dictionary of all message properties
jms.properties
dictionary<string, string>
dictionary<string, string>
String Message Property
jms.property[​'propName']
string
string
Boolean Message Property
jms.property[​'propName']
boolean
boolean, string
Long Message Property
jms.property[​'propName']
integer
integer, string
Double Message Property
jms.property[​'propName']
float
float, string
Byte Message Property
jms.property[​'propName']
Not supported
string
Short Message Property
jms.property[​'propName']
Not supported
string
Integer Message Property
jms.property[​'propName']
Not supported
string
Float Message Property
jms.property[​'propName']
Not supported
string
JMSX Property
jms.xproperty[​'propName']
same as other properties
same as other properties
Dictionary of all JMSX properties
jms.xproperties
dictionary<string, string>
dictionary<string, string>
TextMessage Body
jms.body.textmessage
string, event [1]
string, event [1]
MapMessage Body
jms.body.mapmessage
dictionary<string, string>
dictionary<string, string>
MapMessage Body Entry
jms.body.mapmessage[​'mapKey']
string
string
ObjectMessage Body with a serializable java.util.Map <Object,Object>
jms.body. objectmessage
dictionary<string, string>
dictionary<string, string>
ObjectMessage Body with a serializable java.util.List <Object>
jms.body. objectmessage
sequence<string>
sequence<string>
ObjectMessage Body with any serializable Object
jms.body. objectmessage
N/A
string
BytesMessage Body
jms.body.bytesmessage
string, sequence<string>, dictionary<string, string>, event
string, sequence<string>, dictionary<string, string>
TextMessage, MapMessage, BytesMessage, ObjectMessage, Message
jms.body.type
string
string
[1] If a string from the JMS message is mapped to an event, the string should be either of:
*An Apama event string (as generated by the Apama Event Parser), whose event type matches the type of the field it is being mapped to in the source/target Apama event.
*An XML document starting with a < character, whose structure matches what is implied by the event type definition it is being mapped to (see Convention-based XML mapping for more information)
Note, the JMS headers JMSMessageID, JMSRedelivered and JMSDeliveryMode are supported for completeness but will not normally be required by Apama applications, since built-in duplicate detection based on application-level unique identifiers replaces the first two, and rather than overriding the per-message delivery mode it is usually best to use the default PERSISTENT/NON_PERSISTENT setting implied by the sender's senderReliability value.
Resolver expressions for obtaining ids
The following tables describe resolver expressions for obtaining sender, receiver, and connection IDs. You cannot use these expressions to set ids.
For sending messages
Description
${jmsSender['senderId']}
Get the sender id of the sender that is sending the event from your Apama application to a JMS broker.
${jmsSender[‘connectionId’]}
Get the connection id of the sender that is sending the event from your Apama application to a JMS broker.
For receiving messages
Description
${jmsReceiver[‘receiverId’]}
Get the receiver id of the receiver in your Apama application that received the JMS message from a JMS broker.
${jmsReceiver[‘connectionId’]}
Get the connection id of the receiver in your Apama application that received the JMS message from a JMS broker.
String methods in mapping expressions
In JUEL mapping expressions, you can use certain string methods in the parts of the mapping expressions that evaluate to string types. The table below describes the string methods you can use. These methods use the same-named java.lang.String methods. The mapping expressions are evaluated first to obtain a result string and then any specified string method is applied. You use these functions in the following way:
${some_expression.substring(5)}
In the previous format, some_expression is an expression that evaluates to a string. In the following examples, f1 is a field of type string:
${apamaEvent['f1'].toString().contains('in')}
${jms.body.textmessage.toString().startsWith('sample')}
String method
Description
equalsIgnoreCase('str')
Returns a boolean value that indicates whether the result string is equal to the specified string, ignoring case.
contains('str')
Returns a boolean value that indicates whether the result string contains the specified string.
matches('regex')
Returns a boolean value that indicates whether the result string matches the specified Java regular expression.
startsWith('str')
Returns a boolean value that indicates whether the result string starts with the specified string.
endsWith('str')
Returns a boolean value that indicates whether the result string ends with the specified string.
toLowerCase()
Converts the result string to lowercase and returns it.
toUpperCase()
Converts the result string to uppercase and returns it.
concat('str')
Appends the result string with the specified string and returns this result.
replaceAll('regex','regexReplacement')
In the result string, for each substring that matches regex, this method replaces the matching substring with regexReplacement. The string with replacement values is returned.
The regexReplacement string may contain backreferences to matched regular expression subsequences using the \ and $ characters, as described in the Oracle API documentation for java.util.regex.Matcher.replaceAll(). If a literal $ or \ character is required in regexReplacement be sure to escape it with a backslash, for example: "\$" or "\\".
substring(startIndex,endIndex)
Returns a new string, which is a substring of the result string. The returned substring includes the character at startIndex and subsequent characters up to but not including the character at endIndex.
substring(startIndex)
Returns a new string, which is a substring of the result string. The returned string includes the character at startIndex and subsequent characters including the last character in the string.
trim()
Returns a copy of the result string with leading and trailing whitespace removed.
Binary methods in mapping expressions
In JUEL mapping expressions, you can use certain binary methods in the parts of the mapping expressions that evaluate to binary data. The table below describes the binary methods you can use.
Binary method
Description
byteArrayToBase64(byteArray)
Encodes a byte array to a Base64-encoded string.
base64ToByteArray(string)
Decodes a Base64-encoded string to a byte array.
javaObjectToByteArray(object)
Serializes the serializable Java object to a byte array.
byteArrayToJavaObject(base64String)
Deserializes the byte array to a serializable Java object.
Copyright © 2013-2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.