有2个topic,分别是jms/topic/GetterTopic和jms/topic/ErrTopic
我有1个mdb,如下:
@MessageDriven(mappedName = "jms/topic/GetterTopic", activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue = "IGetterBean"),
@ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "IGetterBean")
})
public class IGetterMBean implements MessageListener {
...
}按理来说,该mdb只接收jms/topic/GetterTopic的消息,但是我向jms/topic/ErrTopic发消息时,这个IGetterMBean也收到消息了?
我有1个mdb,如下:
@MessageDriven(mappedName = "jms/topic/GetterTopic", activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue = "IGetterBean"),
@ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "IGetterBean")
})
public class IGetterMBean implements MessageListener {
...
}按理来说,该mdb只接收jms/topic/GetterTopic的消息,但是我向jms/topic/ErrTopic发消息时,这个IGetterMBean也收到消息了?
你这里的jms/topic/GetterTopic应该是JNDI名吧。 你先在glassfish界面管理工具(http://localhost:4848,端口根据实际情况修改一下)上看一看有2个topic,分别是jms/topic/GetterTopic和jms/topic/ErrTopic是不是指向同一个物理topic了。
如上图,2个topic的name值都是PhysicalTopic,是不是这个原因造成的,如果是,应该怎么修改?
如上图:我没看到图,但是已经知道你就是这个原因了,
就是因为你jms/topic/GetterTopic和jms/topic/ErrTopic只是一个JNDI名称而已,
他们都指向了一个物理的topic(PhysicalTopic),所以才出现这个问题。修改方法:
1:在管理console(http://localhost:4848)再新建一个物理Topic,比如叫:ErrPhysicalTopic,方法与你建PhysicalTopic是一样的。
2:在console的JNDI节点选择jms/topic/ErrTopic,然后修改它的物理queue指向:PhysicalTopic--〉ErrPhysicalTopic就ok了。
==〉
2:在console的JNDI节点选择jms/topic/ErrTopic,然后修改它的物理topic指向