user4903
user4903

Reputation:

How to delay a JMS message from reaching the queue using Spring JmsTemplate

I don't want to block the message consumer with a receiver timeout, because as I understand it this "ties up" a thread in the queue server pool (and we have multiple queues configured). So how can I delay the message from being sent without a custom thread (the work is being performed by an EJB 2 session bean)? If it helps, JBoss Messaging 1.x is the provider.

Upvotes: 1

Views: 1049

Answers (1)

Aviram Segal
Aviram Segal

Reputation: 11120

Scheduled delivery is a feature of JBoss Messaging...

long now = System.currentTimeMillis(); 
Message msg =
sess.createMessage();  
msg.setLongProperty(JBossMessage.JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME, now + 1000 * 60 * 60 * 2); 
prod.send(msg);

Upvotes: 3

Related Questions