I'm using IBM MQ with Spring Boot and I'm trying to delay messages with the setDeliveryDelay(time) method. This function is only supported in JMS 2.0 and I'm having problems with this, as I am running with JMS 1.1 and I cannot figure out how to upgrade to 2.0
I'm using this dependency
implementation(group: 'com.ibm.mq', name: 'mq-jms-spring-boot-starter', version: '2.6.2')
and creating this bean:
@Bean("mqTemplate")
public JmsTemplate jmsClient(ConnectionFactory connectionFactory) throws JMSException {
System.out.println(connectionFactory.createConnection().getMetaData().toString());
JmsTemplate temp = new JmsTemplate(connectionFactory);
return temp;
}
Then I simply set the delay and send the message:
jmsTemplate.setDeliveryDelay(101010);
jmsTemplate.convertAndSend(queue, message);
At startup I can see this:
| com.ibm.msg.client.jms.internal.JmsConnectionMetaDataImpl@71f29d91 :-
| | XMSC_JMS_MAJOR_VERSION :- 1
| | XMSC_JMS_MINOR_VERSION :- 1
| | XMSC_JMS_VERSION :- 1.1
| | XMSC_MAJOR_VERSION :- 6
| | XMSC_MINOR_VERSION :- 0
| | XMSC_OBJECT_IDENTITY :- 1911725457
| | XMSC_PROVIDER_NAME :- IBM MQ
| | XMSC_VERSION :- 6.0
| | XMSC_WMQ_COMMAND_LEVEL :- 910
| | XMSC_WMQ_PROVIDER_VERSION :- 6.0.0.0
And as you can see the XMSC_JMS_VERSION
is 1.1
and when I try to send to the queue I get the following error:
JMSCC5008: Use of the JMS2.0 Function 'Delayed Delivery' is not supported with this instance of this connection
This makes sense since I'm not using JMS 2.0, but can I change the JMS version from 1.1 to 2.0?
Make sure the SVRCONN
you connect to has a SHARECNV
value of 1
or higher, if it is set to 0
the client will treat the queue manager being connected to as a v6 queue manager which didn't support JMS 2.0 features including delayed delivery, shared subscriptions. It also does not support IBM MQ auto reconnect logic and bidirectional heart beat messages.