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 API Support » ERROR 2033, MQRC_NO_MSG_AVAILABLE, But messages in queue

Post new topic  Reply to topic Goto page 1, 2  Next
 ERROR 2033, MQRC_NO_MSG_AVAILABLE, But messages in queue « View previous topic :: View next topic » 
Author Message
Nroblex
PostPosted: Wed Apr 16, 2008 3:53 am    Post subject: ERROR 2033, MQRC_NO_MSG_AVAILABLE, But messages in queue Reply with quote

Novice

Joined: 15 Apr 2008
Posts: 11

Hello I am new to MQ and I really need some help from you profs. So thanks in advance!

Here is my question:

I Have installed MQ server on a ordernary windows XP machine and created a queuemanager named "PMC" I have created two queues under this manager, named PMCQueue and PMCIncomming.

It is no problems to put messages to PMCqueue and I can browse them with the MQ Explorer. But when I use the get- method of MQQueue (the response queue) I always get 2033 MQRC_NO_MSG_AVAILABLE.

When I put a message of request type do I always get an answer then ??

The code is as follows:

try {
mqManager = new MQQueueManager ("PMC");
}
catch (MQException e) {
string mText = mqText.getMQRCText(e.Reason);
MessageBox.Show("Felmeddelande : " + e.Message + " " + mText);
return;
}

//Försöka öppna sändkön...
try {

sendQueue =
mqManager.AccessQueue("PMCQueue", MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);
}
catch (MQException e) {
string mText = mqText.getMQRCText(e.Reason);
MessageBox.Show("Felmeddelande : " + e.Message + " " + mText);
return;
}

//Försöka öppna mottagarkön.
try {
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE | MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING;
responseQueue =
mqManager.AccessQueue("PMCIncomming", openOptions);



}

catch (MQException e) {
string mText = mqText.getMQRCText(e.Reason);
MessageBox.Show("Felmeddelande : " + e.Message + " " + mText);
return;
}

try {
MQMessage sendMessage = new MQMessage();

MQPutMessageOptions pmo = new MQPutMessageOptions();


sendMessage.WriteString(Message);

sendMessage.Format = MQC.MQFMT_STRING;
sendMessage.Persistence = 1;

sendMessage.MessageType = MQC.MQMT_REQUEST;

//sendMessage.Report = MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID;
sendMessage.ReplyToQueueName = txtQueueIncomming.Text ;

//sendQueue.Put(sendMessage); // put request message
sendQueue.Put(sendMessage, pmo);

//string b = GetMessage(sendMessage.MessageId);

mqManager.Commit();

sendQueue.Close();

txtMessage.Text = "";

//Response...
MQMessage responseMessage = new MQMessage();
//responseMessage.CorrelationId = sendMessage.MessageId ;

responseMessage.MessageId = sendMessage.MessageId;


MQGetMessageOptions getOption = new MQGetMessageOptions();
getOption.Options = MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_WAIT;

// getOption.Options = MQC.MQGMO_WAIT;
getOption.WaitInterval = 1000; // 1 sek.
//getOption.MatchOptions = MQC.MQMO_MATCH_CORREL_ID;
getOption.MatchOptions = MQC.MQMO_MATCH_MSG_ID;




if (ReadResponse) {

try {

responseQueue.ClearErrorCodes();

//[HERE Comes the error]
responseQueue.Get(responseMessage, getOption);
//responseQueue.Get(responseMessage);

string MQServerAnswer = responseMessage.ReadString(responseMessage.TotalMessageLength);

if (MQServerAnswer.Length > 0)
lblMQAnswer.Text = "Svar från server: " + MQServerAnswer;
else
lblMQAnswer.Text = string.Empty;

sendQueue.Close();
}

catch (MQException e) {
string mText = mqText.getMQRCText(e.Reason);
MessageBox.Show("Felmeddelande : " + e.Message + " " + mText);
lblMQAnswer.Text = string.Empty;
return;
}
}

I would be very happy if someone could tell me what I am doing wrong

Best regards
Anders in Sweden
Back to top
View user's profile Send private message
AkankshA
PostPosted: Wed Apr 16, 2008 4:15 am    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

Quote:
getOption.MatchOptions = MQC.MQMO_MATCH_MSG_ID;



get msg only matching with message id..

might be the cause....

though i would state my limited programming experience...
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Wed Apr 16, 2008 4:18 am    Post subject: Re: ERROR 2033, MQRC_NO_MSG_AVAILABLE, But messages in queu Reply with quote

Grand High Poobah

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

Nroblex wrote:
When I put a message of request type do I always get an answer then ??


Only if an application answers you.

Nroblex wrote:
I would be very happy if someone could tell me what I am doing wrong


Whatever is answering you is generating a new message id, so you get a 2033. You've set the "match msg id" option, so only messages that match are returned. Be aware that 2033 is "no messages available matching your requirements" not "no messages at all".

Typically you'd also see the request message id in the reply correlation id, not the reply message id, but that's just convention / best practice.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Apr 16, 2008 4:38 am    Post subject: Re: ERROR 2033, MQRC_NO_MSG_AVAILABLE, But messages in queu Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Vitor wrote:
Typically you'd also see the request message id in the reply correlation id, not the reply message id, but that's just convention / best practice.


There are actually options on the MQMD to specify what the requesting application wants here, and how the server application should handle it.

But that's right now outside the level of detail that Nroblex is worried about.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 16, 2008 4:40 am    Post subject: Re: ERROR 2033, MQRC_NO_MSG_AVAILABLE, But messages in queu Reply with quote

Grand High Poobah

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

jefflowrey wrote:
Vitor wrote:
Typically you'd also see the request message id in the reply correlation id, not the reply message id, but that's just convention / best practice.


There are actually options on the MQMD to specify what the requesting application wants here, and how the server application should handle it.

But that's right now outside the level of detail that Nroblex is worried about.




Just trying to add some value
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Nroblex
PostPosted: Wed Apr 16, 2008 5:10 am    Post subject: Reply with quote

Novice

Joined: 15 Apr 2008
Posts: 11

Thanks for your replies!

My question is ; Why does not this piece of code work?? :

responseQueue.Get(responseMessage, getOption);

After I have posted the message with the "put" function I can actually browse the message with MQ Explorer. Then I run the piece of code above, but I always get error 2033???

Please help!

Nroblex
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 16, 2008 5:23 am    Post subject: Reply with quote

Grand High Poobah

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

Nroblex wrote:
After I have posted the message with the "put" function I can actually browse the message with MQ Explorer.


Is the message in the PMCQueue or the PMCIncomming queue?

What message id does it show?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Apr 16, 2008 5:24 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Well, technically, it *does* work. It just doesn't do what you want it to do..



Let's be clear, though, about what is or isn't happening. 1) You're writing a message to the PMCQueue. 2) You're trying to get a message from PMCIncomming queue.

Is there is something else, running and working correctly, that is supposed to be reading from PMCQueue and putting to PMCIncomming?

Where do you see the messages piling up? On PMCQueue or PMCIncomming?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Nroblex
PostPosted: Wed Apr 16, 2008 12:08 pm    Post subject: Reply with quote

Novice

Joined: 15 Apr 2008
Posts: 11

Hello and thanks for the answer

I can see the message in the PMCqueue, if I browse with MQ explorer. This is really the message I sent. But I supposed I should be able to see the message replay in the PMCIncomming queue??? Or have I missed something here ??

What I really want to do is to make sure that my message really is posted to the queue, and that I can garantee this. Is there an other way for this ??

Many Thanks!!

Nroblex
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Apr 16, 2008 12:15 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

There has to be something that is TAKING messages from PMCQueue and creating replies and PUTTING them on PMCIncomming.

MQ doesn't do this for you automatically.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 16, 2008 12:30 pm    Post subject: Reply with quote

Grand High Poobah

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

Nroblex wrote:
I supposed I should be able to see the message replay in the PMCIncomming queue??? Or have I missed something here ??


Yes. A mechanism by which it would be getting to the other queue. What would be putting a message to that queue? Be it a reply or not?

Nroblex wrote:
What I really want to do is to make sure that my message really is posted to the queue, and that I can garantee this. Is there an other way for this ??


Yes - put a message to the queue, and not get an exception. It's what WMQ does, IBM have put a lot of work into ensuring it & it's why you pay the license fee.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
AkankshA
PostPosted: Wed Apr 16, 2008 8:24 pm    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

Nroblex wrote:
Hello and thanks for the answer

I can see the message in the PMCqueue, if I browse with MQ explorer. This is really the message I sent. But I supposed I should be able to see the message replay in the PMCIncomming queue??? Or have I missed something here ??

What I really want to do is to make sure that my message really is posted to the queue, and that I can garantee this. Is there an other way for this ??

Many Thanks!!

Nroblex


MQ can send you the reply but only if you specify.. you can read about the report options .. COA and COD for that

since you are a newbie with MQ, i would suggest you take that lab later on.. and finish this one first...


_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Thu Apr 17, 2008 1:06 am    Post subject: Reply with quote

Grand High Poobah

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

AkankshA wrote:
MQ can send you the reply but only if you specify.. you can read about the report options .. COA and COD for that


Pedantically those are not replies to the request, but simply reports on progress.

Nroblex: Before using the COA & COD options to "make sure your message is really posted", I would urge you to look through the posts in here discussing the subject. It's a seductive idea, but opens you up to a number of problems.

Unless you have a really pressing requirement (and a manager fussing about checking message delivery is not one of those) accept that WMQ offers assured delivery for each message accepted (hence the checking of the put) and put your efforts into ensuring WMQ itself is properly configured rather than reading report messages.

My 2 cents, other positions are supportable.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
AkankshA
PostPosted: Thu Apr 17, 2008 1:18 am    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

Vitor wrote:
AkankshA wrote:
MQ can send you the reply but only if you specify.. you can read about the report options .. COA and COD for that


Pedantically those are not replies to the request, but simply reports on progress.

Nroblex: Before using the COA & COD options to "make sure your message is really posted", I would urge you to look through the posts in here discussing the subject. It's a seductive idea, but opens you up to a number of problems.

Unless you have a really pressing requirement (and a manager fussing about checking message delivery is not one of those) accept that WMQ offers assured delivery for each message accepted (hence the checking of the put) and put your efforts into ensuring WMQ itself is properly configured rather than reading report messages.

My 2 cents, other positions are supportable.




i knew this would come and thats why i mentioned

Akanksha wrote:
since you are a newbie with MQ, i would suggest you take that lab later on.. and finish this one first...




_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
Nroblex
PostPosted: Thu Apr 17, 2008 6:09 am    Post subject: Reply with quote

Novice

Joined: 15 Apr 2008
Posts: 11

Thanks again my friends!

Is it possible anyone could send me a pice of code example on this ??

I want to post a message on the queue, that is ok, but I also want some confirmation that the message really has arrived.

Thanks in advance!

//Nroblex
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » ERROR 2033, MQRC_NO_MSG_AVAILABLE, But messages in 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.