• Post Reply Bookmark Topic Watch Topic
  • New Topic

Same listener MDB for different jms queue  RSS feed

 
Greg Triant
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Is it possible to define the same message driven bean as a listener to different queues?
The goal being to define different redelivery configuration for different kind of messages, but handle them all through a single deployment MDB for unity/entity purposes.

The other option is to have many MDBs targeted to the same source code. But I like more the first option

Thank you
 
Ron McLeod
Saloon Keeper
Posts: 1564
222
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If all messages are being handled by the same consumer and processed in a similar way, why not use a single queue and set a message property to indicate the kind of message?
 
Greg Triant
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because as I described I want different message redelivery policies.
For example message 'A' should be retried for ever, every 5 minutes.
Message 'B' should be retried 5 times every 20 minutes and then have an error destination MDB
e.t.c.

These are configured on the jms queue, not on the message.
 
Ron McLeod
Saloon Keeper
Posts: 1564
222
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry - I missed that in your original post.

My understanding is that a MDB can only listen on one destination. Also, with the MQ that I have worked with (HornetQ), the redelivery policy is statically configured on a per-queue basis, and there is no way for the producer to override this. I'm sure this is what you have found as well.

Greg Triant wrote:The other option is to have many MDBs targeted to the same source code

Do you mean duplicating source code in each MDB, or calling a common processing method implemented in another class?
 
Greg Triant
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will use deployment descriptors instead of annotations so as to have a unique same file. I will build different MDBs, so as to listen to each queue, but they will all build through the same java file.

I really don't understand though why it would not be possible to have a consumer listen to more than one queues.
Anybody knows something more?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!