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 retrive message from a queue

Post new topic  Reply to topic
 help retrive message from a queue « View previous topic :: View next topic » 
Author Message
paolone
PostPosted: Tue Apr 27, 2010 5:24 am    Post subject: help retrive message from a queue Reply with quote

Newbie

Joined: 26 Apr 2010
Posts: 8

Hello. I'm trying to put a message on a requestQueue and retrive the response on a responseQueue. The put and the get seems to work but it seems that the response i read is the "first" in the queue not the correlated. I think there is somthing wrong in the correlationID. Any soggestion?
thanks a lot and sorry for my english...


MQMessage queueMessage = new MQMessage();
queueMessage.WriteString(messqaggio);

queueMessage.Format = MQC.MQFMT_STRING;
queueMessage.MessageType = MQC.MQMT_REQUEST;
queueMessage.ReplyToQueueManagerName = this.queueManagerName;
queueMessage.ReplyToQueueName = this.ResponseQueueName;


MQPutMessageOptions queuePutMessageOptions = new MQPutMessageOptions();
queuePutMessageOptions.Options = MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID;

this.RequestQueue.Put(queueMessage, queuePutMessageOptions);
this.RequestQueue.Close();


MQMessage queueMessageResp = new MQMessage();

MQGetMessageOptions queueGetMessageOptions = new MQGetMessageOptions();
queueGetMessageOptions.MatchOptions = MQC.MQMO_MATCH_CORREL_ID;
queueGetMessageOptions.Options = MQC.MQGMO_WAIT;
queueGetMessageOptions.WaitInterval = 4 * 1000;

this.ResponseQueue.Get(queueMessageResp, queueGetMessageOptions);

sMessage = queueMessageResp.ReadString(queueMessageResp.MessageLength);

result = sMessage;


this.ResponseQueue.Close();
this.queueManager.Disconnect();

}[/b]
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 27, 2010 5:31 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

You set the match options to read a message by correl id. At what point in the code do you specify which correl id it should match on?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
paolone
PostPosted: Tue Apr 27, 2010 6:03 am    Post subject: Reply with quote

Newbie

Joined: 26 Apr 2010
Posts: 8

Vitor wrote:
You set the match options to read a message by correl id. At what point in the code do you specify which correl id it should match on?


thanks for replay...i'm despered:)

Nowhere. I have just a little experience with MQ. I tought that using
queuePutMessageOptions.Options = MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID;

MQ copy the message ID in the correlationID of the response queue so that the GET metod retrive the right message.
I'm a little confused...
Where should i specify wich which correl id it should match on?

thanks a lot
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 27, 2010 6:15 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

paolone wrote:
MQ copy the message ID in the correlationID of the response queue so that the GET metod retrive the right message.


How does the GET know which request you're looking for the response of?

paolone wrote:
Where should i specify wich which correl id it should match on?


It's the message id of the request (logically enough) as that's what you've specified be used as the correl id of the response in your code.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
paolone
PostPosted: Tue Apr 27, 2010 6:26 am    Post subject: Reply with quote

Newbie

Joined: 26 Apr 2010
Posts: 8

Vitor wrote:
paolone wrote:
MQ copy the message ID in the correlationID of the response queue so that the GET metod retrive the right message.


How does the GET know which request you're looking for the response of?

paolone wrote:
Where should i specify wich which correl id it should match on?


It's the message id of the request (logically enough) as that's what you've specified be used as the correl id of the response in your code.


ok, i understood the problem but where and how i tell the get method which message retrive (how can associate the request messageid whit the response correlation id?)
sorry for my stupid question Victor but I.m new in MQ and i'm in trouble...

can you post an example please? tahnks a lot
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 27, 2010 6:42 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

paolone wrote:
ok, i understood the problem but where and how i tell the get method which message retrive (how can associate the request messageid whit the response correlation id?)


You specify the id in question in the get message MQMD.

paolone wrote:
sorry for my stupid question Victor but I.m new in MQ and i'm in trouble...


I so need to change my name.....

You're right you are. WMQ is not a simple product to handle or learn & while I applude your efforts at writing code I urge you to seek formal training or mentoring from an experienced person.

I also wonder if your desperation comes from this not being a training exercise but a work related task which you should have pushed back on because you're too new.

You should at least spend some time with the Intercommunication manual & other documentation to get a grounding.

paolone wrote:
can you post an example please?


There's sample code supplied with the product, and more via the link at the top of this page.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
paolone
PostPosted: Tue Apr 27, 2010 6:53 am    Post subject: Reply with quote

Newbie

Joined: 26 Apr 2010
Posts: 8

Vitor wrote:
paolone wrote:
ok, i understood the problem but where and how i tell the get method which message retrive (how can associate the request messageid whit the response correlation id?)


You specify the id in question in the get message MQMD.

paolone wrote:
sorry for my stupid question Victor but I.m new in MQ and i'm in trouble...


I so need to change my name.....


i'm sorry, vitor

Vitor wrote:
You're right you are. WMQ is not a simple product to handle or learn & while I applude your efforts at writing code I urge you to seek formal training or mentoring from an experienced person.


i know it's not a simple product and you are right i need training or mentoring from an experienced person but i can't bacause i must go on with my work (i'm a c# developer in bank). The problem is that we are in outsourcing with MQ and we have no support at all!


Vitor wrote:
I also wonder if your desperation comes from this not being a training exercise but a work related task which you should have pushed back on because you're too new.


my desperation come by the fact that 5 days ago a didn't know what mq was...and i'm trying to be helpful for my company.

So thanks for the time you spent.
bye
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 27, 2010 7:33 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

paolone wrote:
i'm sorry, vitor


Don't be - everybody thinks there's a "c" in it, not just you.

Vitor wrote:
You're right you are. WMQ is not a simple product to handle or learn & while I applude your efforts at writing code I urge you to seek formal training or mentoring from an experienced person.


paolone wrote:
i must go on with my work (i'm a c# developer in bank). The problem is that we are in outsourcing with MQ and we have no support at all!


You can't go on with work which you're not trained or equipted to do. What's next, getting you to rewire the building? Even if outsourced, someone must be running your WMQ estate.

paolone wrote:
my desperation come by the fact that 5 days ago a didn't know what mq was...and i'm trying to be helpful for my company.


It's a tale we hear all too often in here. There's a time to be helpful, and a time to push back. You also need to ensure they remember how "helpful" you've been at pay rise time.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 retrive message from a 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.