[GLASSFISH-19492] MDB @MessageDriven listens on Topic for @JMSDestinationDefinition className="javax.jms.Queue" Created: 03/Jan/13  Updated: 06/Jan/13  Resolved: 06/Jan/13

Status: Resolved
Project: glassfish
Component/s: jms
Affects Version/s: 4.0_b68_EE7MS3
Fix Version/s: 4.0_b71

Type: Bug Priority: Critical
Reporter: amyk Assignee: Simon Meng
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is duplicated by MQ-264 Async receiver does not receive the m... Closed
Tags: jms-2-implementation


Please see Arun's async receiver sample (which is currently commented as not working in the following blog link) and analysis in MQ-264

Comment by Nigel Deakin [ 03/Jan/13 ]

I have tried this in the debugger and agree that this appears to be the problem.

If you define a MDB which uses mappedName to refer to a queue resource created in the normal way (e.g. using glassfish-resources.xml) then ActivationSpec.setDestinationType() is called with a value of "javax.jms.Queue".

However if you define a MDB which uses mappedName to refer to a queue resource created using a @JMSDestinationDefinition annotation then ActivationSpec.setDestinationType() is NOT called. As a result the MDB creates a consumer on a topic (but the correct physical name).

So this seems to be an issue specifically with resources created using a @JMSDestinationDefinition annotation.

There is a workaround, which is to explicitly specify the destinationType activation property. Note that setting this property should not be necessary.

@MessageDriven(mappedName = "java:global/jms/myQueue", activationConfig =
 {@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")})
Comment by arungupta [ 03/Jan/13 ]

Tried the workaround in my simple sample and it worked.

Comment by Simon Meng [ 05/Jan/13 ]

Assume we create a jms destination resource via the following command:
asadmin create-jms-resource --restype javax.jms.Queue --property Name=myQueue jms/myQueue
The resource should be created successfully. It appears in domain.xml

In an application (a MDB), it also defines a jms destination by annotation

@JMSDestinationDefinition(name = "jms/myQueue",
resourceAdapterName = "jmsra",
className = "javax.jms.Queue",
description="My Queue9")

@MessageDriven(mappedName = "jms/myQueue")
public class MessageReceiverAsync implements MessageListener

{ .... }

When deploy a MDB, we need use the mappedName to find jms destination resource in domain.xml or EJbMessageBeanDescriptor. I need know the clear answer for the following questions:

1. If the mappedName does not start with "java:" prefix, whether need add "java:comp/env" prefix to match the resources.
2. If two jms destination resources have the same name (name does not start with "java:" prefix), the two resources are defined in both domain.xml and application, which resource should be used.

Comment by Simon Meng [ 06/Jan/13 ]

Fixed at revision 57990.

Generated at Sat Oct 01 20:05:04 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.