EJB消息驱动注释中的多个队列 [英] mulitple queues in EJB messagedriven annotation
问题描述
我有3个队列,MDBbean需要侦听这三个队列,因此,根据读取输入,我将为每种输入类别拆分任务。
截至目前,该代码仅适用于一个队列,而我不知道如何实现多个队列。
@MessageDriven(mappedName = receiver1)
公共类MDBMessages实现了MessageListener
我如何使我的MDBMessage侦听接收器2和接收器3队列。
感谢
Prabhakar
来自文档:
为
单个消息传递类型定义了一个消息驱动bean,并根据
及其
使用的消息侦听器接口对其进行了定义。
因此,不可能为多个目标类型映射MDB。
还没有尝试过,但是您可以尝试在ejb-jar.xml中使用指向同一类&的不同JNDI名称配置MDB。向其中的每个添加不同的目的地。如果配置可行,则MDBMessages将能够侦听xml中所有指定队列的消息。
I have 3 queues and these three queues need to be listened by MDBbean and accordingly based on reading input, i will split out the task for each category of input.
As of now, the code is working fine for only one queue and i don't know how to implement it for more than one queue. Could you please guide me
@MessageDriven(mappedName="receiver1")
public class MDBMessages implements MessageListener
How i can make my MDBMessage to listen for receiver2 and receiver 3 queue.
Thanks Prabhakar
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.
这篇关于EJB消息驱动注释中的多个队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!