2

Is there any option in hornetq to set message consumer delay. if so kindly help with an example. Our Req: We need MDB to read message with a constant 2 min delay.

MaDa
  • 10,511
  • 9
  • 46
  • 84
vairam
  • 471
  • 1
  • 11
  • 26

3 Answers3

0

One option is to put a JMS header that has the time you want to process the message at. For example, 2 minute from when you create the message. Then, your reader can have a time based selector that only selects messages where that header is > the current time.

Dave
  • 13,518
  • 7
  • 42
  • 51
0

I don't think this is the usual use-case for MDBs. Are you sure you need an MBD? Have you thought about Topic queues?

Or can you describe the business reasons for requiring a delay?

anders.norgaard
  • 1,062
  • 13
  • 23
  • we need it for EDI processing, when an EDI request comes in, the messages related to that edi should be processed and sent after 2 min. – vairam Dec 29 '11 at 05:05
0

OK - then I think you should just get the message, use a

http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/DelayQueue.html

and use that with a scheduler service like Quartz or the new timer-stuff in EJB3.1.

Best, Anders

anders.norgaard
  • 1,062
  • 13
  • 23