Author |
Message
|
nupadhay |
Posted: Wed Mar 08, 2006 1:48 pm Post subject: How to read all messages in a queue at once and dump in file |
|
|
Newbie
Joined: 08 Mar 2006 Posts: 4
|
In the C# code(partially extracted code) below I am reading 1 message at a time. If I have 5000 messages in the queue I have to execute the code 5000 times. I want to read all 5000 messages at once and dump it into a file. How can I do it in C#?
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
objQueue = (MQAX200.MQQueue)objQueueManager.AccessQueue(QueueName, OpenOptions, "", "", "");
MQMessage GetMQMessage = new MQMessage();
objQueue.Get(GetMQMessage, objGMO, MaxMsgSize);
string MessageString = GetMQMessage.ReadString(GetMQMessage.MessageLength);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks for any suggestions |
|
Back to top |
|
 |
wschutz |
Posted: Wed Mar 08, 2006 6:33 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
sorry... you can only get 1 message at a time ....
by the way, you don't need to accessQueue 5000 times..only do that once.... _________________ -wayne |
|
Back to top |
|
 |
nagak |
Posted: Thu Mar 09, 2006 10:55 am Post subject: |
|
|
Novice
Joined: 14 Dec 2004 Posts: 11
|
There is tool IH03(IBM Support pack) using that you can dump all the messages from the Queue to your file.
thanks |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Mar 10, 2006 1:05 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi nagak,
I think nupadhay needs to run some code as batch process or something and then dump the same to a file...
Using IH03 will mean that he will have to come every morning and move the messages manually
And anyway, IH03 will also pick all the messages one-by-one and then paste then at one go into the file...or maybe pste one-by-one
The important thing is that it will NOT pick all the messages will one API call.
Regards. |
|
Back to top |
|
 |
nupadhay |
Posted: Fri Mar 24, 2006 10:58 am Post subject: I want to be able to do it using .NET frammework or any dlls |
|
|
Newbie
Joined: 08 Mar 2006 Posts: 4
|
I cannot believe that we don't have have any dll that would bulk read all the messages from queue or atleast we can specify say 5000 messages at a time. |
|
Back to top |
|
 |
wschutz |
Posted: Fri Mar 24, 2006 11:33 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
This seems to be a popular topic today .... may I suggest that you write a class or subroutine (depending on your language) that makes as many MQ calls as you like and then calls that class (or subroutine). _________________ -wayne |
|
Back to top |
|
 |
kevinf2349 |
Posted: Fri Mar 24, 2006 11:39 am Post subject: |
|
|
 Grand Master
Joined: 28 Feb 2003 Posts: 1311 Location: USA
|
Whether you believe it or not is up to you, but you can't do it.
You could roll-your-own wrapper to do it but frankly the processing time for calling the wrapper and grabbing the messages, and all the associated logic that goes into that (whether the message is for you, the size of each message etc) is going to cost you far more cycles than just repeated calling of the MQGET.
What you are wanting is a little bit akin to expecting all your mail to be delivered to your house in one big envelop....it ain't happening and it is probably a good thing that it isn't  |
|
Back to top |
|
 |
PeterPotkay |
Posted: Fri Mar 24, 2006 12:21 pm Post subject: Re: I want to be able to do it using .NET frammework or any |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
nupadhay wrote: |
I cannot believe that we don't have have any dll that would bulk read all the messages from queue or atleast we can specify say 5000 messages at a time. |
What happens when there are only 4000 messages?
What happens when message # 1234, 2254, 4585, etc have some sort of problem preventing a succesful get for just those?
What happens when all 5000 messages are 100 megabytes?
Trust me, I'm sure some powerful minds at IBM thought of this idea a long time ago, and determined it is not a good idea. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
nupadhay |
Posted: Fri Mar 24, 2006 12:36 pm Post subject: |
|
|
Newbie
Joined: 08 Mar 2006 Posts: 4
|
All I want to do is cut down the time taken to read 500,000 messages from the queue which is 7-8 hours. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Fri Mar 24, 2006 12:41 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
7 hours = 25,200 seconds.
500,000 messages into 25,200 seconds = about 20 messages a second.
How big are these messages? _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
wschutz |
Posted: Fri Mar 24, 2006 1:09 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Quote: |
How big are these messages? |
and.... is this a server binding or a client connection? and if client, what is the speed of the network between the client and the server? how many hops (latency?) _________________ -wayne |
|
Back to top |
|
 |
EddieA |
Posted: Fri Mar 24, 2006 3:36 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
And are they persistent, and how often are you taking a syncpoint.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
sirsi |
Posted: Mon Apr 03, 2006 2:37 pm Post subject: |
|
|
Disciple
Joined: 11 Mar 2005 Posts: 177
|
|
Back to top |
|
 |
|