Author |
Message
|
VijayGoparaju` |
Posted: Wed Aug 27, 2008 11:25 pm Post subject: Copying the specified number of messages in Queues |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
Hello All,
I have a problem I have to copy a particular number of messages from one Source queue to Destination queue, But only the first message is being copied number of times.I am not getting all the messages to Destination Queue.
I have cleared the message between 2 GET Methods,one is opened to browse and other is opened to put message, but still I am getting the first message many number of times.
The code:
queueMessage.MessageId = MQC.MQMI_NONE;
queueMessage.CorrelationId =MQC.MQCI_NONE;
Can any one help me,
Thanks,
Vijay. |
|
Back to top |
|
 |
David.Partridge |
Posted: Wed Aug 27, 2008 11:35 pm Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
Read up about browse first, browse next.
Read the source code of amqsbcg for some hints. _________________ Cheers,
David C. Partridge |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Thu Aug 28, 2008 12:19 am Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
I have read FIRST and NEXT but wheres the problem coming????? |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Aug 28, 2008 4:21 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
You're not moving your browse cursor. Your program is stuck pointing at the first message. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Thu Aug 28, 2008 7:29 pm Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
I have used this line for getting to the next message after
queueMessage.MessageId = MQC.MQMI_NONE;
queueMessage.CorrelationId =MQC.MQCI_NONE;
queueGetMessageOptions.Options = MQC.MQGMO_BROWSE_NEXT;
queue.Get(queueMessage, queueGetMessageOptions);
But I have used NEXT for next message, But how to move the cursor to the next Message can you please tell me.
Thanks,
Vijay.... |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Aug 29, 2008 7:00 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I'd suggest taking a look at amqsbcg0.c. It is written in C, but it should show the necessary options and steps to walk through a queue. |
|
Back to top |
|
 |
dkeister |
Posted: Fri Aug 29, 2008 8:16 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
If you a utility to do that meets your needs, but mqexerciser can do it.
I have just added options to copy messages where you can select a number of messages or messages with text matching a selection filter. You can copy:
- just the message,
- the message and MQMD,
-the message with MQMD but create a new MsgID.
This version is not on website yet so if you are interested, contact me directly (dean@mqexerciser.com) and I'll get you that version. _________________ Dean Keister |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Sun Aug 31, 2008 9:47 pm Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
I just want first 10 or first 20 messages to be copied from source to destination Queue please send the options to send them..
Just send me the lines of code to get copied.
Thanks,
Vijay.... |
|
Back to top |
|
 |
dkeister |
Posted: Mon Sep 01, 2008 7:44 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
Hello Vijay,
Ain't going to do your work for you...
However, if you want to copy messages you might
1. Browse first message on queue. You then have the message content and MQMD but the message is still on the queue.
2. Using the information from the Browse, put the message and depending on your requirements, use the MQMD retrieved from the browse using the appropriate PMO options.
3. Browse next to get message content and MQMD for the second message. This message is also still on the queue.
4. Repeat step 2.
5. Repeat steps 3 and 4 for the number of messages you want to copy.
If there are messages being gotten from the queue by another application while you are copying, you need to understand how that impacts your application. You might, for instance, inhibit the queue for gets.
Hope this gives you a clue.
Dean _________________ Dean Keister |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Mon Sep 01, 2008 8:03 pm Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
Thanks for your suggestion,
Please tell me how to move the cursor position to the next record and retreive the message? |
|
Back to top |
|
 |
David.Partridge |
Posted: Mon Sep 01, 2008 10:47 pm Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
|
Back to top |
|
 |
dkeister |
Posted: Tue Sep 02, 2008 6:02 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
I think RTFM (MQSeries Application Programming Guide) and looking at the code sample are the best ways to learn how to do this. The principle is this:
Open the queue with the MQOO_BROWSE option
To Browse the first message, set the get message option for the first to MQGMO_BROWSE_FIRST and issue MQGET.
For subsequent messages, set the get message option to MQGMO_BROWSE_NEXT, make sure the MsgID and CORRELId fields of the MQMD strucrure are set to null, and issue MQGET.
Take it step by step and you should be able to figure it out. _________________ Dean Keister |
|
Back to top |
|
 |
zpat |
Posted: Tue Sep 02, 2008 7:15 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Browse next will work for each MQGET (IBM realise that you mean to start at the first message...) |
|
Back to top |
|
 |
dkeister |
Posted: Tue Sep 02, 2008 7:59 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
That is true if you have just opened the queue for browse or never browsed before.
for example, if you open the queue for browse, the browse cursor is positioned logically just before the first message on the queue so browse next gets the first message. However, if you have already browsed the first message (and possibly more), the browse cursor will be somewhere else. If I want to be sure to start with the first message, I find it safest to set browse first. (Just my obsessive/compulsive nature - my wife says I'm anal recessive!) _________________ Dean Keister |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Mon Sep 08, 2008 1:38 am Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
Thanks for your Replies I tried by using this also Still I am not getting the next messages.I have to Copy those messages into destination Queue from Source Queue.
Please help Me,
Thanks,
Vijay.... |
|
Back to top |
|
 |
|