jms on jboss: how to set delay time of message
"The delay represents a time interval after whi开发者_StackOverflow社区ch the message becomes available to the Message Consumer. A message specified with a delay is in a waiting state until the delay expires and the message becomes available"
how to set it on JBoss (5.1)? thanks
Here is my solution:
for (int i = 1; i < num_of_your_message; i++) {
message.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY",
(new Date()).getTime() + 5000 * i);
message.setObject(your_object);
producer.send(message);
}
You appear to be quoting a passage from the Oracle AQ JMS manual. If you'd quoted a couple of more sentences, that would have been clear...
Delay for a message is specified as message property (JMS_OracleDelay). This property is not specified in the JMS standard. It is an AQ extension to JMS message properties.
If JBoss 5.1 has a similar proprietary extension, read their docs on how to use it. If not, you're out of luck.
BEA's (now Oracle's) WLS JMS has a similar feature (added in version 7?). Maybe it's a popular thing for vendors to add. Maybe you'll get lucky w/ JBoss...
精彩评论