为什么我们只能在EJB中的消息驱动bean中设置单个目标类型?
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "FileProcess"),
@ActivationConfigProperty(propertyName = "transactionTimeout", propertyValue = "3600"),
@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "100") })
@TransactionManagement(value = TransactionManagementType.CONTAINER)
public class FileMDB implements MessageListener {
//.....
}
我想为单个MSD添加多个目标类型,我可以在MDB类中添加多个队列名称或目标类型吗?
答案 0 :(得分:0)
简短的回答是:因为Sun(和JSR专家组)就是这样设计的。
答案越长:我猜你需要处理许多包含相同格式消息的队列,并且对于消息来自的服务并不重要。你可以:
MessageListener
接口的基类,并根据需要多次继承,每次应用不同的@ActivationConfigProperty
注释。