Issue Details (XML | Word | Printable)

Key: GLASSFISH-19492
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Simon Meng
Reporter: amyk
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
glassfish

MDB @MessageDriven listens on Topic for @JMSDestinationDefinition className="javax.jms.Queue"

Created: 03/Jan/13 07:37 AM   Updated: 06/Jan/13 08:47 AM   Resolved: 06/Jan/13 08:47 AM
Component/s: jms
Affects Version/s: 4.0_b68_EE7MS3
Fix Version/s: 4.0_b71

Time Tracking:
Not Specified

Issue Links:
Duplicate
 

Tags: jms-2-implementation
Participants: amyk, arungupta, Nigel Deakin and Simon Meng


 Description  « Hide

Please see Arun's async receiver sample (which is currently commented as not working in the following blog link) and analysis in MQ-264
https://blogs.oracle.com/arungupta/entry/simple_jms_2_0_sample



Nigel Deakin added a comment - 03/Jan/13 10:10 AM

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")})

arungupta added a comment - 03/Jan/13 11:43 PM

Tried the workaround in my simple sample and it worked.


Simon Meng added a comment - 05/Jan/13 08:46 AM

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",
destinationName="myQueue9",
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.


Simon Meng added a comment - 06/Jan/13 08:47 AM

Fixed at revision 57990.