ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » [HELP] Unable to consume reply message from Queue

Post new topic  Reply to topic
 [HELP] Unable to consume reply message from Queue « View previous topic :: View next topic » 
Author Message
sjunejo
PostPosted: Thu Dec 02, 2010 2:58 am    Post subject: [HELP] Unable to consume reply message from Queue Reply with quote

Novice

Joined: 12 Sep 2008
Posts: 16

Hi,

I am having problem consuming messages from MQ Server Queue. I am using WebSphere MQ Server 7 with my web application to put messages on IN Queue which will then Consume by my MDB deployed on jBoss and put reply back on OUT Queue.

My web application is deployed on jBoss 4.2.3 and I am using MQ Resource Adapter to connect to MQ Server.

I am able to successfully put message on IN Queue where MDB is listening which consume the messages, do some processing and put reply back on OUT Queue where my web application is waiting for a response but it get TIMED OUT. I mean I can see the response in MQ Explorer which is just sitting there waiting to be consumed but my web application can not recognize for some reason.

I have tried with simpler Co-relation ID like '1' but didn't work. I am using following code to do all of the above;

Code:

Connection connection = null;
Session session = null;
MessageProducer producer = null;
Destination reqQueue = null;
Destination repQueue = null;
try {
timeStart = System.currentTimeMillis();
InitialContext ctx = new InitialContext(); // Initial Context of type JMS Connection Factory
Object factoryObj = ctx.lookup(jmsCxFactory);
ConnectionFactory cxf = (ConnectionFactory)factoryObj;

connection = cxf.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
connection.start();
_serviceLocator = new ServiceLocator(); // Look up queues
reqQueue = _serviceLocator.lookupDestination("queue/INQueue");
repQueue = _serviceLocator.lookupDestination("queue/OUTQueue");
producer = session.createProducer(reqQueue); // Register a producer
Message jmsMsg = session.createTextMessage(message); // Assign request to Message object so we can send it to Database Server later.
jmsMsg.setJMSReplyTo(repQueue); // Preparing a class to wait for a response on Response queue
producer.setDisableMessageID(false); // Make sure messages gets an id
String correlationId = "1"; // Get and set unique Correlation ID so we can receive correct messages
jmsMsg.setJMSCorrelationID(correlationId);
jmsMsg.setStringProperty("FORMAT", pingLevel); // Set the message format
producer.send(jmsMsg); // Put message on Queue
MessageConsumer receiver = session.createConsumer(repQueue, "JMSCorrelationID='" + correlationId + "'"); // Now receive message
long JMSConnectionTimeout = 5000L; // Set timeout value - Default 10 Sec.
Message reply = receiver.receive(JMSConnectionTimeout); // Now receive a response
if (reply instanceof TextMessage) {
String response = ((TextMessage)reply).getText();
passedReq++; // Increment in the passed request counter
} else {
finalResponse += "Request : Timed Out..."; <--- Always timed Out and control ends up here
failedReq++; // Increment in number of time out requests
}
}
catch (NamingException e) {
finalResponse += "Error Occured : Naming Exception - " + e.getMessage();
}
catch (JMSException e) {
finalResponse += "Error Occured : JMS Exception - " + e.getMessage();
}
catch (RuntimeException e) {
finalResponse += "Error Occured : Runtime Exception - " + e.getMessage();
}
finally {
closeResource(producer);
closeResource(connection);
closeResource(session);
}




Does anyone know what could be the reason and why its happening? Your help and comments will be appreciated.

Thanks

--

SJunejo
Back to top
View user's profile Send private message
Mr Butcher
PostPosted: Thu Dec 02, 2010 3:32 am    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

did you verify with the mq explorer or any other proper utility that the corelid in the reply is what you expect?
_________________
Regards, Butcher
Back to top
View user's profile Send private message
sjunejo
PostPosted: Thu Dec 02, 2010 3:52 am    Post subject: YES.... Reply with quote

Novice

Joined: 12 Sep 2008
Posts: 16

Mr Butcher wrote:
dod you verify with the mq explorer that the corelid in the reply is what you expect?


I have checked it in MQ Explorer and its same as you can see I am using the same variable with my receiver as follows;

Sender

Code:

String correlationId = "1"; // Get and set unique Correlation ID so we can receive correct messages
jmsMsg.setJMSCorrelationID(correlationId);


Receiver
Code:

MessageConsumer receiver = session.createConsumer(repQueue, "JMSCorrelationID='" + correlationId + "'"); // Now receive message


Regards,
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 03, 2010 1:38 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Check you have the latest version of MQ (7.0.1.3) and if it still doesn't work open a PMR.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
sjunejo
PostPosted: Fri Dec 03, 2010 1:46 am    Post subject: I have the latest Version.....But it used to work before.... Reply with quote

Novice

Joined: 12 Sep 2008
Posts: 16

I have the latest version 7.0.1.3. Also I have configured it before myself and it use to work but it was not the latest version but I think the base release. Could it be possible for me to have a link to download the base version because I am having doubt on this latest version. I tried to download the base version but IBM Software Catalogue is only showing 7.0.1.3 links not base version.

Regards,
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 03, 2010 2:00 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

The version being out of the way, try changing your code

Code:
outmsg.setJMSCorrelationID ( "whatever");
String mycorrelid = outmsg.getJMSCorrelationID();

and use mycorrelid in your selector...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
sjunejo
PostPosted: Fri Dec 03, 2010 2:48 am    Post subject: Code changed.... but still.... Reply with quote

Novice

Joined: 12 Sep 2008
Posts: 16

I have changed code and tried but still the same..message is just waiting and my web application just TimedOut. following is the result;

Code:

Setting CorrelationID = 73A6FBB03B04BA96162454DC9477A40Ef335cc24c1612b95
Creating Consumer with CorrelationID Extracted from outmsg.getJMSCorrelationID() = 73A6FBB03B04BA96162454DC9477A40Ef335cc24c1612b95

Request [1] : Timed Out...



Both Co-relation ID's are exactly the same...but I don;t know....Also I just want to add up here that in MQ Explorer when I check the request and reply message Co-relation ID is like 'half' of the above as follows;

Code:

[b]73A6FBB03B04BA96162454DC[/b]


I don't know if its just the way MQ Explorer is displaying the ID or its really triming it?

I don't know what I can do next.....

I think I will try with 7.0.1.0 version as it was working before.

Let me know if you guys can think of anything else.

Regards
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 03, 2010 9:44 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

If it is not working at 7.0.1.3 open a PMR with IBM. They'll help you fix it.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
sjunejo
PostPosted: Sat Dec 04, 2010 2:12 am    Post subject: Can anyone confirm please... Reply with quote

Novice

Joined: 12 Sep 2008
Posts: 16

fjb_saper wrote:
If it is not working at 7.0.1.3 open a PMR with IBM. They'll help you fix it.


I can raise a PMR but just wanted to make sure that its really a problem....can someone else confirm its really not working....

Regards,
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » [HELP] Unable to consume reply message from Queue
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.