Author |
Message
|
zpat |
Posted: Mon Sep 08, 2008 1:51 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Post your code (use the code button), our powers of ESP are limited... |
|
Back to top |
|
 |
Mr Butcher |
Posted: Mon Sep 08, 2008 2:08 am Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
what have you tried exactly
what are the results
any error messages
any returncodes
post your code
or use on of the utilities available.
is this a homework question?  _________________ Regards, Butcher |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Mon Sep 08, 2008 3:21 am Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
I have opened the first Queue like this:
queue = queueManager.AccessQueue( QueueName1.Text, MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_BROWSE );
queueGetMessageOptions.Options = MQC.MQGMO_BROWSE_FIRST;
and secong Queue like this:
queue = queueManager.AccessQueue(QueueName2.Text, MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING );
queueMessage.ClearMessage();
queueMessage.MessageId = null;
queueMessage.CorrelationId = null;
queue.Get(queueMessage, queueGetMessageOptions);
queueGetMessageOptions.Options= MQC.MQGMO_BROWSE_NEXT;
queuemessage=queueMessage.ReadString(queueMessage.MessageLength);
queueGetMessageOptions.Options = MQC.MQGMO_MSG_UNDER_CURSOR;
Please tell me Where the Error is?
Thanks & Regards,
Vijay... |
|
Back to top |
|
 |
zpat |
Posted: Mon Sep 08, 2008 3:39 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Why are people fixated on the GET UNDER CURSOR? - you only use this if you want to destructively get a message.
You do not need to use it to browse each message in a queue.
Just use BROWSE NEXT on each MQGET (even the first one if you like) and you will get each message from the queue. |
|
Back to top |
|
 |
dkeister |
Posted: Mon Sep 08, 2008 9:00 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
To add to zpat's post.
If you want to copy messages, why are you setting MQC.MQGMO_MSG_UNDER_CURSOR? The Application Programming Reference states that is option causes the message pointed to by the browse cursor to be retrieved. The message is removed from the queue. Further, the browse cursor is not moved by a nonbrowse MQGET.
Let's assume there are three messages on the queue Msg1=Red, Msg2=White, Msg3=Blue.
When you open the queue for browse, the browse cursor is point before the first message on the queue. If you use either MQGMO_BROWSE_NEXT or MQGMO_BROWSE_FIRST, the browse cursor will then point to the message that is first on the queue (Red). If you MQGET using MQGMO_MSG_UNDER_CURSOR (a destructive MQGET), you get the Red message and remove it from the queue BUT THE BROWSE CURSOR IS NOT MOVED. The message that was second on the queue (White) now becomes the first message on the queue. Now if you MQC.MQGMO_BROWSE_NEXT the browse cursor will point to the second message on the queue (Blue). If this is your sequence, you should never browse the White message.
If you are really trying to COPY messages, not MOVE messages from one queue to another, issue MQGET with MQGMO_BROWSE_NEXT after opening the queue with the appropriate options. If the return from MQGET is successful, the return from MQGET will have nondistructively browsed the appropriate message and you will have copies of the MQMD and message text returned to you.
You can then use these copies to MQPUT the message (and optionally the MQMD) to another queue.
I would suggest once again that you read the Application Programming Guide section on Browsing messages on a queue, section on Getting a particular message, and the Application Programming Reference for MQGMO_BROWSE_MSG_UNDER_CURSOR, MQGMO_MSG_UNDER_CURSOR, MQGMO_BROWSE_FIRST, MQGMO_BROWSE_NEXT, and MQGMO_BROWSE_MSG_UNDER_CURSOR (you probably do not need this option but it never hurts to expand your knowledge). _________________ Dean Keister |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Tue Sep 09, 2008 9:38 pm Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
I have tried these options also but the Cursor is not moving to the next Message. Always it is retreving the first message.I am not able to understand the correct problem?????
Thanks,
Vijay.... |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Sep 10, 2008 2:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
VijayGoparaju` wrote: |
I have tried these options also but the Cursor is not moving to the next Message. Always it is retreving the first message.I am not able to understand the correct problem?????
Thanks,
Vijay.... |
Stop opening and closing the queue for each loop. You need to do this outside of the loop.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Wed Sep 10, 2008 9:23 pm Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
Thank You Very Much for all your Replies. My Application is Working Really Fine. My problem is solved.
Thank You once again to one and all.
Vijay.....  |
|
Back to top |
|
 |
|