Solace IBM MQ Connector -Why outgoing message to IBM MQ has expiry time instead of -1 [Non Expiring]
Hi Solace community,
I am using solace IBM MQ connector to send solace message to MQ client as well as consuming message send from MQ client to solace.
I have an issue where outgoing MQ message header to MQ contains expiry value set to something that is not -1 [Non Expiring]. Is this a bug? Or is there a way to override it?
Thanks, any help would be appreciated. Being troubled with this for some time.
Best Answers
-
Hi Chewaiwu,
In JMS, Expiration is a read-only property and can't be set on an outgoing message. Instead, timeToLive is set which results in Expiration being set on the message.
By default, the IBM MQ Connector sets timeToLive=0 on ongoing messages to MQ. This can be controlled with the
jms_timeToLive
message header. From the User-Guide's JMS Headers section:To see the actual timeToLive value set on outgoing messages, you can enable logging for the following package:
logging: level: root: info com.solace.spring.cloud.stream.binder: TRACE # Enables TRACE logs for Solace and JMS binders
and look for this log statement:
2024-02-14T19:12:15.504-05:00 DEBUG 2486 --- [pool-5-thread-1] .s.s.c.s.b.j.o.JmsOutboundMessageHandler : <MessageHandler ID: ef0ebdd4-b9ef-4588-b482-9fe363425203-1> Synchronously sending JMS message [ com.ibm.jakarta.jms.JMSBytesMessage ] to destination [ queue:///DEV.QUEUE.1 ], priority [ 4 ], timeToLive [ 0 ]
Now, if timeToLive is set to 0 and messages are still expiring on the MQ broker, you can check whether the
CAPEXPRY
MQ Queue property is set. CAPEXPRY enforces expiration times on all messages.1
Answers
-
Hi Chewaiwu,
In JMS, Expiration is a read-only property and can't be set on an outgoing message. Instead, timeToLive is set which results in Expiration being set on the message.
By default, the IBM MQ Connector sets timeToLive=0 on ongoing messages to MQ. This can be controlled with the
jms_timeToLive
message header. From the User-Guide's JMS Headers section:To see the actual timeToLive value set on outgoing messages, you can enable logging for the following package:
logging: level: root: info com.solace.spring.cloud.stream.binder: TRACE # Enables TRACE logs for Solace and JMS binders
and look for this log statement:
2024-02-14T19:12:15.504-05:00 DEBUG 2486 --- [pool-5-thread-1] .s.s.c.s.b.j.o.JmsOutboundMessageHandler : <MessageHandler ID: ef0ebdd4-b9ef-4588-b482-9fe363425203-1> Synchronously sending JMS message [ com.ibm.jakarta.jms.JMSBytesMessage ] to destination [ queue:///DEV.QUEUE.1 ], priority [ 4 ], timeToLive [ 0 ]
Now, if timeToLive is set to 0 and messages are still expiring on the MQ broker, you can check whether the
CAPEXPRY
MQ Queue property is set. CAPEXPRY enforces expiration times on all messages.1