<< Back to previous view

[MQ-264] Async receiver does not receive the message Created: 22/Dec/12  Updated: 03/Jan/13  Resolved: 03/Jan/13

Status: Closed
Project: mq
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: arungupta Assignee: amyk
Resolution: Duplicate Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates GLASSFISH-19492 MDB @MessageDriven listens on Topic ... Resolved
Tags:
Participants: amyk, arungupta, David Zhao and Ed Bratt

 Description   

Here is a trivial MessageSender:

@Stateless
public class MessageSender {

    @Inject
    JMSContext context;

    @Resource(lookup = "java:global/jms/myQueue")
    Queue queue;

    public void sendMessage(String message) {
        context.createProducer().send(queue, message);
    }
}

The following message receiver works fine:

@Stateless
public class MessageReceiverSync {

    @Inject
    private JMSContext context;

    @Resource(lookup = "java:global/jms/myQueue")
    Queue myQueue;

    public String receiveMessage() {
        String message = context.createConsumer(myQueue).receiveBody(String.class, 1000);
        return "Received " + message;
    }
}

But the following one does not receive the message:

@MessageDriven(mappedName = "java:global/jms/myQueue")
public class MessageReceiverAsync implements MessageListener {

    @Override
    public void onMessage(Message message) {
        try {
            TextMessage tm = (TextMessage) message;
            System.out.println("Message received: " + tm.getText());
        } catch (JMSException ex) {
Logger.getLogger(MessageReceiverAsync.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
} 

The destination definition is defined as:

@JMSDestinationDefinition(name = "java:global/jms/myQueue",
        resourceAdapterName = "jmsra",
        className = "javax.jms.Queue",
        destinationName="java:global/jms/myQueue",
        description="My Queue")
@WebServlet(name = "TestServlet", urlPatterns = {"/TestServlet"})
public class TestServlet extends HttpServlet {


 Comments   
Comment by Ed Bratt [ 02/Jan/13 07:24 PM ]

Please investigate

Comment by David Zhao [ 02/Jan/13 11:45 PM ]

destinationName in the annotation definition should be the physical destination name, "java:global/jms/myQueue" may be not suitable for that.

Comment by amyk [ 03/Jan/13 12:42 AM ]

Arun's following blog seems to indicate this jira is still an issue for the sample @JMSDestinationDefinition in the blog appears using correct destinationName attribute setting
https://blogs.oracle.com/arungupta/entry/simple_jms_2_0_sample

emailed Arun to confirm

Comment by arungupta [ 03/Jan/13 01:37 AM ]

Confirmed with b68.

Comment by arungupta [ 03/Jan/13 01:37 AM ]

Here is the updated annotation:

@JMSDestinationDefinition(name = "java:global/jms/myQueue",
resourceAdapterName = "jmsra",
className = "javax.jms.Queue",
destinationName="queue1234",
description="My Queue")
@WebServlet(urlPatterns = {"/TestServlet"})
public class TestServlet extends HttpServlet {

Comment by amyk [ 03/Jan/13 07:02 AM ]

This is a GlassFish server side bug - The MDB for the async sample listens on a Topic whereas the @JMSDestintionDefinition specifies it as className="javax.jms.Queue" (see below JMSRA debug logging in server.log). If send a message to Topic 'queue1234', the MDB receives the message.

A GlassFish jira issue is filed: GLASSFISH-19492

----- imqcmd list dst with the sample war deployed
queue1234 Topic RUNNING 0 0 1 0 0 0 0 0 0.0

----- server.log
[#|2013-01-02T21:44:34.547-0800|FINER|44.0|javax.resourceadapter.mqjmsra.inbound.message|_ThreadID=73;_ThreadName=admin-listener
(2);_TimeMillis=1357191874547;_LevelValue=400;ClassName=com.sun.messaging.jms.ra.ResourceAdapter;MethodName=endpointActivation()
;|ENTRY my:my:MessageReceiverAsync ActvationSpec configuration=
DestinationType =javax.jms.Topic
Destination =queue1234
MessageSelector =null
AcknowledgeMode =Auto-acknowledge
SubscriptionDurability =NonDurable
useSharedSubscriptionInClusteredContainer=true
ClientId =null
SubscriptionName =null
EndpointPoolMaxSize =32
EndpointPoolSteadySize =0
EndpointPoolResizeCount =8
EndpointPoolResizeTimeout =600
EndpointExceptionRedeliveryAttempts =1
EndpointExceptionRedeliveryInterval =500
SendUndeliverableMsgsToDMQ =true
GroupName =null
RAUID =null
InClusteredContainer =false
MdbName =null
UserName =null
AddressList (configured) =null
AddressList (in effect) =localhost:7676
addressListBehavior (configured) =null
addressListBehavior (in effect) =PRIORITY
addressListIterations (configured) =0
addressListIterations (in effect) =3
reconnectAttempts (configured) =0
reconnectAttempts (in effect) =3
reconnectInterval (configured) =0
reconnectInterval (in effect) =5000
options =null

#]
Comment by amyk [ 03/Jan/13 07:04 PM ]

Close as duplicated of GLASSFISH-19492

Generated at Fri Apr 18 21:19:50 UTC 2014 using JIRA 4.0.2#472.