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 » How to read all messages in a queue at once and dump in file

Post new topic  Reply to topic
 How to read all messages in a queue at once and dump in file « View previous topic :: View next topic » 
Author Message
nupadhay
PostPosted: Wed Mar 08, 2006 1:48 pm    Post subject: How to read all messages in a queue at once and dump in file Reply with quote

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
View user's profile Send private message
wschutz
PostPosted: Wed Mar 08, 2006 6:33 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
nagak
PostPosted: Thu Mar 09, 2006 10:55 am    Post subject: Reply with quote

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
View user's profile Send private message
elvis_gn
PostPosted: Fri Mar 10, 2006 1:05 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
nupadhay
PostPosted: Fri Mar 24, 2006 10:58 am    Post subject: I want to be able to do it using .NET frammework or any dlls Reply with quote

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
View user's profile Send private message
wschutz
PostPosted: Fri Mar 24, 2006 11:33 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
kevinf2349
PostPosted: Fri Mar 24, 2006 11:39 am    Post subject: Reply with quote

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
View user's profile Send private message
PeterPotkay
PostPosted: Fri Mar 24, 2006 12:21 pm    Post subject: Re: I want to be able to do it using .NET frammework or any Reply with quote

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
View user's profile Send private message
nupadhay
PostPosted: Fri Mar 24, 2006 12:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
PeterPotkay
PostPosted: Fri Mar 24, 2006 12:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
wschutz
PostPosted: Fri Mar 24, 2006 1:09 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
EddieA
PostPosted: Fri Mar 24, 2006 3:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
sirsi
PostPosted: Mon Apr 03, 2006 2:37 pm    Post subject: Reply with quote

Disciple

Joined: 11 Mar 2005
Posts: 177

you can use this support pack - MO03

http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg24009368&loc=en_US&cs=utf-8&lang=en

or

check out this also - MA01

http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg24000647&loc=en_US&cs=utf-8&lang=en
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » How to read all messages in a queue at once and dump in file
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.