Author |
Message
|
hoa_lan_trang1982 |
Posted: Tue Nov 28, 2006 6:50 pm Post subject: How to browse messages in queue? |
|
|
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 |
|
 |
jefflowrey |
Posted: Tue Nov 28, 2006 6:53 pm Post subject: |
|
|
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 |
|
 |
hoa_lan_trang1982 |
Posted: Tue Nov 28, 2006 7:39 pm Post subject: |
|
|
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 |
|
 |
Vitor |
Posted: Wed Nov 29, 2006 12:29 am Post subject: |
|
|
 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 |
|
 |
sneh |
Posted: Wed Nov 29, 2006 5:42 am Post subject: |
|
|
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 |
|
 |
FrankBo |
Posted: Thu Dec 07, 2006 9:54 am Post subject: How to browse messages in queue? |
|
|
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 |
|
 |
vennela |
Posted: Thu Dec 07, 2006 9:05 pm Post subject: |
|
|
 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 |
|
 |
|