Monday, November 25, 2013

WebLogic JMS: setting TTL (time to live) aka Expiration Time on messages

you can set a Time To Live for a JMS message using the WLS console, with "Overrides / Time-to-Live Override", but you should also select the "Delivery Mode Override:" = Persistent, otherwise you get this error:
Message icon - Error An error occurred during activation of changes, please see the log for details.
Message icon - Error [Management:141191]The prepare phase of the configuration update failed with an exception:
Message icon - Error VALIDATION PROBLEMS WERE FOUND problem: cvc-enumeration-valid: string value 'No-Delivery' is not a valid enumeration value for delivery-mode-type in namespace

then you should also choose what to to with the expired message (Expiration Policy:), best thing is to redirect it to an Error Destination.

The weird thing is that this TTL Override doesn't see to work when you create a new JMS message from the WL console. If you monitor the JMS messages in the queue, the JMS Expiration is still set to 0.
In OSB, you can assign a default "JMS expiration" to the Business Service sending messages to the JMS destination, or you can assign a JMS Expiration at runtime (even in the test console).
Another way is to set the "Default Time-to-Live:" at Connection Factory level.
This is the WLST code to set the Override at JMS Destination level:
#you should have created a PV_OSB_TESTModule JMSModule and a PV_OSB_TESTQ Distributed Queue






No comments: