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 » Unable to post data to MQ Queue

Post new topic  Reply to topic
 Unable to post data to MQ Queue « View previous topic :: View next topic » 
Author Message
msvpraveen
PostPosted: Tue Jul 19, 2005 7:51 am    Post subject: Unable to post data to MQ Queue Reply with quote

Novice

Joined: 07 Jul 2005
Posts: 12

I have a C++ program in which I am trying to get some data from a request queue and post the acknowledgement to a reply queue.I am able to get the data from the request queue.Though I am not getting any errors when I try to put the data in reply queue.No data is getting posted to the reply queue.

I have pasted the part of code where I am trying to post the data to reply queue. I tried with mesg.write as well as mesg.writeItem
Code:



                       out_queue.setConnectionReference(mgr);
       out_queue.setOpenOptions(MQOO_OUTPUT + MQOO_INQUIRE  + MQOO_FAIL_IF_QUIESCING);

   if( !out_queue.open()) {
      cout<<"ImqQueue::open failed with reason code "
      <<(long)out_queue.reasonCode( )<<endl;
      log_fileout<<"ImqQueue::open failed with reason code "
      <<(long)out_queue.reasonCode( )<<endl;
            //Failure Occured
      flag_success = 0;
                         }

                   /* Preparing the Acknowledgement */
                   mesg_data_buffer = new char[8];
                   msg.useEmptyBuffer(mesg_data_buffer,sizeof(mesg_data_buffer));
                   msg.setFormat(MQFMT_STRING);
                  //Add our acknowledgement string to the message.
                   ImqString successFlag("SUCCESS");
                   ImqString failureFlag("FAILURE");

                   if(flag_success)
                   {
                      strcpy(mesg_data_buffer,"SUCCESS");
                      writeItemFlag = msg.writeItem(successFlag);
                   }
                   else
                   {
                      strcpy(mesg_data_buffer,"FAILURE");
                      writeItemFlag = msg.writeItem(failureFlag);
                   }

                   cout<<"Posting data: "<<mesg_data_buffer<<endl;
                   log_fileout<<"Posting data: "<<mesg_data_buffer<<endl;

                   writeFlag = msg.write(8,mesg_data_buffer);
                   cout<<"Write Flag"<<writeFlag<<endl;
                   log_fileout<<"Write Flag"<<writeFlag<<endl;

                   cout<<"Write Item Flag"<<writeItemFlag<<endl;
                   log_fileout<<"Write Item Flag"<<writeItemFlag<<endl;

                  
                   //msg.write(ourstr.length(), ourstr.c_str());
                     /*
                     msg.messageId().copyOut(msgId, MQ_MSG_ID_LENGTH, 0);
                     msg.setMessageId(msg.correlationId());
                     msg.setCorrelationId(msgId);
                     */

                     
                  // Sending the message to the reply queue.
                   if( !out_queue.put(msg, pmo) )
                   {
                      cout<<"ImqQueue::put failed with reason code "
                      <<(long)out_queue.reasonCode( )<<endl;
                      log_fileout<<"ImqQueue::put failed with reason code "
                      <<(long)out_queue.reasonCode( )<<endl;
                   }
                   cout<<"Posted the message...."<<endl;
                   log_fileout<<"Posted the message..."<<endl;
                  }
               }
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Tue Jul 19, 2005 8:04 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Do you see any messages when using something like amqsbcg?

That is, are there new but blank messages, or are there no new messages?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
msvpraveen
PostPosted: Tue Jul 19, 2005 1:37 pm    Post subject: Reply with quote

Novice

Joined: 07 Jul 2005
Posts: 12

No,there are no new messages in reply queue.
In the API it was specified that write and writeItem will return TRUE if
we are able to write to queue.I am not getting any return values for write or writeItem in my code.
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Tue Jul 19, 2005 1:47 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

msvpraveen wrote:
No,there are no new messages in reply queue.
In the API it was specified that write and writeItem will return TRUE if
we are able to write to queue.I am not getting any return values for write or writeItem in my code.


write doesn't write to the queue. It writes to the message buffer.

put writes to the queue.

Make sure you stop the requesting application, so that it's not actually reading anything from the reply queue - or at least for testing purposes, comment out the code that is supposed to get the reply.

Then, clear the reply queue so that it is empty. Confirm that the qdepth is 0.

Then test your replying program, send it a request.

Confirm that the queue depth on the reply queue is still zero. Do this before you close the replying application.

You may be putting your replies in syncpoint, and not committing them.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
msvpraveen
PostPosted: Wed Jul 20, 2005 10:01 am    Post subject: Reply with quote

Novice

Joined: 07 Jul 2005
Posts: 12

Quote:

Make sure you stop the requesting application, so that it's not actually reading anything from the reply queue - or at least for testing purposes, comment out the code that is supposed to get the reply.

My get method is not reading from the same queue.Anyway I have commented out that code for testing now.
Quote:

Then, clear the reply queue so that it is empty. Confirm that the qdepth is 0.

How can I check that my qdepth is 0 ?
Quote:

You may be putting your replies in syncpoint, and not committing them.

Can you please elaborate on this.




[/quote]
Back to top
View user's profile Send private message Yahoo Messenger
bower5932
PostPosted: Wed Jul 20, 2005 10:44 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

You can use runmqsc to check your current depth. From a command prompt,

runmqsc "your.qmgr.name"
dis ql(YOUR.Q.NAME) curdepth

It will display the current depth of the queue. You could also run the amqsbcg sample against the queue to see if it finds all of these messages.

If you are putting your replies in syncpoint (ie, a unit of work), then you have to let the qmgr that you actually want them committed (mqcmit) in order for them to show up. Go look at the mqsync.* samples at:

http://www.developer.ibm.com/isv/tech/sampmq.html
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Unable to post data to MQ 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.