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 » Problem about to receive message in queue WebSphere MQ

Post new topic  Reply to topic
 Problem about to receive message in queue WebSphere MQ « View previous topic :: View next topic » 
Author Message
titikreyol
PostPosted: Tue Jun 19, 2012 2:36 am    Post subject: Problem about to receive message in queue WebSphere MQ Reply with quote

Newbie

Joined: 19 Jun 2012
Posts: 3

Hello,

work on Websphere MQ since some weeks I encounter a problem.

I'm programming a Java Application who want to request a application on another server with WebSphere MQ but the answer Message in the Queue come just after the timeout (check with MQ Explorer). So I can't consume the message in the queue on my application.

I get the Queue connection Factory and the Queue Receive and Send by the JNDI on my Java application. I think one of them are not parameter like I want to use WebSphere MQ.

Because when I use my application with my own object JMS Client Factory in my Java application, I receive the message at the good time.


To resume my properties of my own JMS Client I initialize :

com.ibm.mq.jms.QueueConnectionFactory

setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP)
setHostName(xx)
setPort(xx)
setChannel(xxx)

com.ibm.mq.jms.MQQueue (for receive queue and send queue)
setBaseQueueManagerName(xxxxxxxx)
setBaseQueueName(xxxx)
setPersistence(JMS.MQJMS_PER_QDEF)
setPriority(JMSC.MQJMS_PRI_QDEF)
setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ)


Let's me know if a software exists for translate this configuration?
I changed my configuration in the Websphere console many time but without sucess.

Thank you


Last edited by titikreyol on Tue Jun 19, 2012 4:54 am; edited 1 time in total
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Jun 19, 2012 2:55 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

use ReceiveTimeout value (eg. 60 seconds, which I think is 6000)
Back to top
View user's profile Send private message
titikreyol
PostPosted: Tue Jun 19, 2012 4:46 am    Post subject: Reply with quote

Newbie

Joined: 19 Jun 2012
Posts: 3

zpat wrote:
use ReceiveTimeout value (eg. 60 seconds, which I think is 6000)


I've my QueueReceiver.receive(10000) but the message come just at the end.
If I change this value it will be the same.

My use of JMS on my program work. So when I initialize my own MQ object everything is fine.

This is when I intialise with my JNDI objets Queue and Queue Connection Factory on websphere the message isn't received before the timeout
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jun 19, 2012 4:55 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You are almost certainly trying to do the PUT of the request in the same transaction as the GET of the response, so the PUT never gets sent until the GET has timed out.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jun 19, 2012 4:57 am    Post subject: Reply with quote

Grand High Poobah

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

titikreyol wrote:
zpat wrote:
use ReceiveTimeout value (eg. 60 seconds, which I think is 6000)


I've my QueueReceiver.receive(10000) but the message come just at the end.
If I change this value it will be the same.

My use of JMS on my program work. So when I initialize my own MQ object everything is fine.

This is when I intialise with my JNDI objets Queue and Queue Connection Factory on websphere the message isn't received before the timeout


You are hitting a problem of transactionality...
If JMS is used in a J2EE appserver the current global transaction will supersede any settings you may have on the session. Make sure you set the send method with transaction not supported...
Your problem is that the send is part of the transaction, so you get the response just after the transaction finished... which in your case seems to be too late.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
titikreyol
PostPosted: Tue Jun 19, 2012 7:52 am    Post subject: Reply with quote

Newbie

Joined: 19 Jun 2012
Posts: 3

It's a session no transactional.
I initialize my objects like that

Code:

// Reset existing object
            close();
           
            // Create a Queue connection from the Queue Connection factory
            connection = connectionFactory.createQueueConnection();
           
            // Create the Queue session
            session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
           
            //Create fake Message
            final BytesMessage message = session.createBytesMessage();
            message.setJMSCorrelationIDAsBytes(correlId);
            correlIdString = message.getJMSCorrelationID();
           
            // Create a receiver
            final String messageSelector = "JMSCorrelationID = '" + correlIdString + "'";
            consumer = session.createReceiver(queueRS, messageSelector);
           
            // Create a sender
            producer = session.createSender(queueRQ);



after for send request id likr yjzy
Code:

final BytesMessage message = session.createBytesMessage();
        message.setJMSCorrelationIDAsBytes(correlId);
        correlIdString = message.getJMSCorrelationID();
        message.setJMSReplyTo(consumer.getQueue());
        message.writeBytes(theBody);
       
        producer.send(message);
   


To receive my message I use this function
Code:

private byte[] waitForByteMessage(final long timeToWait) throws JMSException {
       
        BytesMessage message = null;
        byte[] buffer = null;
       
        if (timeToWait == -1) {
            message = (BytesMessage) consumer.receive();
        } else {
            message = (BytesMessage) consumer.receive(timeToWait);       
        }
       
        if (message != null) {
            // Lecture du flux
            buffer = new byte[(int) message.getBodyLength()];
            message.readBytes(buffer);
        }
       
        return buffer;
    }



When I check my Queue on MQ Explorer.
I see the queue incremented with my message just after the end of the timeTowait the message on the queueReceiver[/quote]
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jun 19, 2012 1:21 pm    Post subject: Reply with quote

Grand High Poobah

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

fjb_saper wrote:
the current global transaction will supersede any settings you may have on the session. Make sure you set the send method with transaction not supported...


Which part of this statement did you not understand?
It does not matter whether your session is declared with false or true... the global transaction will prevail. This is why the message is not in a get-able state until the transaction completes (after your wait time).
The actual response time from the service is probably negligible...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Problem about to receive message in queue WebSphere MQ
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.