[jboss-user] [EJB 3.0] - Re: MDB destination issues

weston.price@jboss.com do-not-reply at jboss.com
Sun Mar 18 15:43:47 EDT 2007


anonymous wrote : 
  | In my deployment scenario I don't know the queue name (i.e. destination) until just prior of load time of my mdb's, i.e. it is unknown at compile time. Is there a way to solve this? 
  | 

Not really. The connection consumer created for your deployment requires the destination to be provided. If you wanted to do a 'trick' I suppose you could provide the value of the destination in your ejb-jar.xml file as a property. At deployment time, JBoss will resolve a property reference to the correct system property. Example


  | <destination>${some.destination}</destination>
  | 

If you take a look at the messagedriven tests in our testsuite, you can see an example of this. Note, for this to work, the name of the destination would have to be set as a system property somehow prior to your deployment. Note, I don't really recommend doing this as it's non standard behavior but it might get you by.

anonymous wrote : 
  | Also, there may very well be cases where messages that can be handled by the same mdb implementation arrive on different queues, is it possible to deploy an mdb multiple times to receive messages from separate queues? 
  | 

You can't deploy the *same* MDB (ie the same MDB name) to multiple queues, but there is nothing to stop you from deploying the same MDB code with different EJB names to multiple destinations. Example:


  | <ejb-name>XListener</ejb-name>
  | <ejb-class>org.example.SomeMDB</ejb-class>
  | 
  | <ejb-name>YListener</ejb-name>
  | <ejb-class>org.example.SomeMDB</ejb-class>
  | 
  | 

Also, there is nothing to stop you from deploying multiple listeners to a single queue, but only one listener will receive a message, not both. Some people use this scheme as a 'poor man's' load balancing for a single destination. 



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029135#4029135

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029135



More information about the jboss-user mailing list