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 » Copying the specified number of messages in Queues

Post new topic  Reply to topic Goto page 1, 2  Next
 Copying the specified number of messages in Queues « View previous topic :: View next topic » 
Author Message
VijayGoparaju`
PostPosted: Wed Aug 27, 2008 11:25 pm    Post subject: Copying the specified number of messages in Queues Reply with quote

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
View user's profile Send private message
David.Partridge
PostPosted: Wed Aug 27, 2008 11:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
VijayGoparaju`
PostPosted: Thu Aug 28, 2008 12:19 am    Post subject: Reply with quote

Acolyte

Joined: 26 Aug 2008
Posts: 72

I have read FIRST and NEXT but wheres the problem coming?????
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Thu Aug 28, 2008 4:21 am    Post subject: Reply with quote

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
View user's profile Send private message
VijayGoparaju`
PostPosted: Thu Aug 28, 2008 7:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
bower5932
PostPosted: Fri Aug 29, 2008 7:00 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
dkeister
PostPosted: Fri Aug 29, 2008 8:16 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
VijayGoparaju`
PostPosted: Sun Aug 31, 2008 9:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
dkeister
PostPosted: Mon Sep 01, 2008 7:44 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
VijayGoparaju`
PostPosted: Mon Sep 01, 2008 8:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
David.Partridge
PostPosted: Mon Sep 01, 2008 10:47 pm    Post subject: Reply with quote

Master

Joined: 28 Jun 2001
Posts: 249

Look here:

http://www-304.ibm.com/jct09002c/isv/tech/sample_code/mq/mqbrowse.java

And study what the code is doing
_________________
Cheers,
David C. Partridge
Back to top
View user's profile Send private message
dkeister
PostPosted: Tue Sep 02, 2008 6:02 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
zpat
PostPosted: Tue Sep 02, 2008 7:15 am    Post subject: Reply with quote

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
View user's profile Send private message
dkeister
PostPosted: Tue Sep 02, 2008 7:59 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
VijayGoparaju`
PostPosted: Mon Sep 08, 2008 1:38 am    Post subject: Reply with quote

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
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 » Copying the specified number of messages in Queues
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.