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 » General IBM MQ Support » How to browse messages in queue?

Post new topic  Reply to topic
 How to browse messages in queue? « View previous topic :: View next topic » 
Author Message
hoa_lan_trang1982
PostPosted: Tue Nov 28, 2006 6:50 pm    Post subject: How to browse messages in queue? Reply with quote

Newbie

Joined: 15 Nov 2006
Posts: 7

I want to get all the messages in a queue but do not clear them. Below is my code that get all the messages in a queue and clear them. Can you help me to edit it. Thanks

Quote:

string QueManager = "QM_APPLE";
//string InQueName = "Q1";
string OutQueName = "CreditCheck";
MQQueueManager qMgr;
//MQQueue InputQueue;
MQQueue OutputQueue;
//UTF8Encoding utf8Enc;

MQMessage retrievedMessage;
MQGetMessageOptions gmo;
int WaitInterval = 3000;
string msgText;

qMgr = new MQQueueManager(QueManager);
int OutOpenOptions = MQC.MQOO_INPUT_AS_Q_DEF |
MQC.MQOO_FAIL_IF_QUIESCING;
OutputQueue = qMgr.AccessQueue(OutQueName, OutOpenOptions);

retrievedMessage = new MQMessage();

gmo = new MQGetMessageOptions();

gmo.Options = MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_WAIT;
gmo.WaitInterval = WaitInterval;// wait time

gmo.MatchOptions = MQC.MQMO_MATCH_CORREL_ID;
listBox1.Items.Clear();
Boolean isContinue = true;
while (isContinue == true)
{
try
{
OutputQueue.Get(retrievedMessage, gmo);
msgText = retrievedMessage.ReadString(retrievedMessage.MessageLength);
listBox1.Items.Add(msgText);
}
catch
{
isContinue = false;
}
}
[/quote]
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Nov 28, 2006 6:53 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You probably don't want to get them without clearing them.

But the word you're looking for to describe "get them without clearing them" is "Browse".

You probably want to use syncpoint.

Why do you want to get messages and leave them sitting on the queue taking up disk space?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
hoa_lan_trang1982
PostPosted: Tue Nov 28, 2006 7:39 pm    Post subject: Reply with quote

Newbie

Joined: 15 Nov 2006
Posts: 7

Quote:
You probably want to use syncpoint.

What is syncpoint?

Quote:
Why do you want to get messages and leave them sitting on the queue taking up disk space?

Example: I have a queue that contains messages. I want those messages can be used by multi programs.
[/quote]
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 29, 2006 12:29 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

hoa_lan_trang1982 wrote:
What is syncpoint?


It defines a boundary to the logical unit of work. Look in the docs or search for a complete description.

But......

hoa_lan_trang1982 wrote:
Example: I have a queue that contains messages. I want those messages can be used by multi programs.


You're trying to use a queue as a database. This is a bad idea on so many levels and will cause you nothing but problems.

If you have many programs that need to receive the same message, the correct way to deal with this is the publish/subscribe model. This has a number of advantages in your situation; the key one is that it works!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sneh
PostPosted: Wed Nov 29, 2006 5:42 am    Post subject: Reply with quote

Apprentice

Joined: 12 Aug 2006
Posts: 28
Location: Mumbai

yes.. and still if u dont want to go for pub-sub then u can write a small wrapper application which will fork 1 queue to many.
N tht is simple. But as said by efflowrey, it will take up disk sp
Back to top
View user's profile Send private message
FrankBo
PostPosted: Thu Dec 07, 2006 9:54 am    Post subject: How to browse messages in queue? Reply with quote

Apprentice

Joined: 08 Dec 2005
Posts: 36

Hello folks, I'm on an AS400 (iSeries/i5) at V5R3, and want to know if there's a way to view the contents of a queue (maybe moving the contents of the queue to a file), then "flush" out any messages that might be in that queue, possibly forcing them to be processed or maybe moving them to a holding queue? This became an issue recently when there were messages in a queue that had not been processed (due to a pgm that monitors that queue being in msgw) and we ran our nightly backups and did not process them until after backups which was NG. I'm not great on MQ but know how to use DSPMQMQ and WRKMQMMSG but there doesn't seem to be a way to automatically clear or process messages that are "stuck" in a queue or haven't been processed yet. Also, is it a correct statement to say that if a msg is in a queue, when MQ is ended and restarted those messages will still be in the queue?
Thanks for any info on this, Frank
Back to top
View user's profile Send private message
vennela
PostPosted: Thu Dec 07, 2006 9:05 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

There is a support pac called Q Program to do that
Search the forum
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » How to browse messages in queue?
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.