mulitple queues in EJB messagedriven annotation

僤鯓⒐⒋嵵緔 提交于 2019-12-06 07:33:13

From Documentation :

A message-driven bean is defined for a single messaging type, in accordance with the message listener interface it employs.

Therefore it will not be possible to map a MDB for multiple destination types.

Haven't tried, but you can try configuring MDB in ejb-jar.xml with different JNDI names pointing to the same class & add different destination to each of them. If configuration works, then MDBMessages will be able to listen messages for all specified queues in xml.

use the deployment descriptor to create multiple instances of your mdb. Each instance listens to one queue.

also there are brokers (like activeMQ) that allow one mdb to listen on multiple destinations of the same type (queue, topic), if they use the activemq resource adapter.

@Consumer(activationConfig = { @ActivationConfigProperty(
propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@**ActivationConfigProperty(propertyName = "destination",
propertyValue = "queue/MyTasksProcess"),**

public class MyProcessorMDBean implements Downloader {

public void processSomething(Serializable anyParameter){
//Do the actual processing
}

for a given message driven bean you can rout your message to single queue so can use only single destination type in your bean class.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!