Pankaj Sejwal
Pankaj Sejwal

Reputation: 1595

Supply of messages in queue to consumer with delay:Weblogic

I could find way to create delay between supply from producer and consumption by consumer.

But I want to know if there is any possible way to create delay on every message.Say I want my consumer to pick only 1 message every 2 seconds but I want my producer to produce at its best performance rate as my consumer is not as efficient as producer. So, is there a way to control delay on each message before it is sent from queue to consumer?

I tried weblogic.jms.extensions.WLMessageProducer producer = (weblogic.jms.extensions.WLMessageProducer)queueSender; on producer

and

`weblogic.jms.extensions.WLMessage message=(weblogic.jms.extensions.WLMessage)tMessage;
 message.setJMSDeliveryTime(20000);` 

onmessage but not seeing any difference.

Upvotes: 0

Views: 1509

Answers (2)

AdrianF
AdrianF

Reputation: 75

there is a bit of a contradiction in your question, in that "consumer to pick only 1 message every 2 seconds" is not the same thing as "control delay on each message before it is sent from queue to consumer". E.g. if your producer was putting in message at say 10,000/hr, and if you put a deal of 30 mins on each message, your consumer would still attempt to consume at 10,000/hr if it could. The only impact of the delay would be that the consumer would not start consuming until 30 mins after the producer started injecting.

Assuming the former is what you want to do, to do this I believe the only option in WebLogic is to implemented something in your consumer code to slow down processing on that side.

Setting Time to Deliver Override on the queue settings implements a delay for each message, but does not change the rate. You can also set the Time to Deliver in code from the producer, but the WebLogic queue setting would take precede (override!) if also set.

Hope thats some help!

Upvotes: 1

Display Name is missing
Display Name is missing

Reputation: 6227

You'll probably want:

((weblogic.jms.extensions.WLMessageProducer)producer).setTimeToDeliver(2000);

http://docs.oracle.com/cd/E15051_01/wls/docs103/javadocs/weblogic/jms/extensions/WLMessageProducer.html#setTimeToDeliver(long)

I'm not sure what your first attempt was supposed to do. But setJMSDeliveryTime has been deprecated since Weblogic 9.

Upvotes: 1

Related Questions