How to write a message selector in BW which will be able to compare the current timestamp with the JMSTimestamp in a message?
book
Article ID: KB0088459
calendar_today
Updated On:
Products
Versions
TIBCO ActiveMatrix BusinessWorks
-
Not Applicable
-
Description
Resolution: Description: ========== There may be a need to consume a message based on how long it has been pending on an TIBCO Enterprise Message Service (EMS) destination, i.e., all messages that have been pending in the queue since more than one hour should be immediately consumed. This solution provides details on the syntax of such message selectors in TIBCO BusinessWorks(BW).
Environment: ===========
TIBCO ActiveMatrix BusinessWorks – All versions TIBCO Enterprise Message Service – All versions All H/W and O/S platforms
Resolution: =========
1). Here a dynamic message selector is needed, as the current time can is supposed to change for each job. Tthere is a need to use “Get JMS Queue Message” to consume messages from the EMS queue which supports dynamic message selectors.
2). In the BW process define a process variable (TimeStamptoCompare) and assign the value of that variable as currentTimestamp -1 hour (the result value will be in milliseconds) using the following xpath formula:
tib:timestamp()-3600000
3). In the input tab of the Get JMS Queue Message activity, define the selector as: