Author |
Message
|
olan022 |
Posted: Thu Sep 25, 2003 4:57 am Post subject: Trigger to delete messages? |
|
|
 Acolyte
Joined: 17 Apr 2002 Posts: 50
|
We are testing an app that drops a large number of messages to a queue. We don't need the messages so it would be ideal to simply have a trigger DELETE every message that comes to the queue. Is there a sample mqm program that can delete the message? I have also tried using a CLEAR QL() runmqsc command within the process definition but the object are in use.
Any suggestions? THanks. |
|
Back to top |
|
 |
olan022 |
Posted: Thu Sep 25, 2003 5:34 am Post subject: |
|
|
 Acolyte
Joined: 17 Apr 2002 Posts: 50
|
fyi
I've tried the sample AMQSGET program to remove the messages but I get a Reason Code 2080 error:
Truncated message returned (processing not completed).
On an MQGET call, the message length was too large to fit into the supplied buffer. The MQGMO_ACCEPT_TRUNCATED_MSG option was not specified, so the message has not been removed from the queue. If this was a browse operation, the browse cursor remains where it was before this call, but if MQGMO_BROWSE_FIRST was specified, the browse cursor is positioned logically before the highest-priority message on the queue.
The DataLength field is set to the length of the message before truncation, the Buffer parameter contains as much of the message as fits, and the MQMD structure is filled in.
Corrective action: Supply a buffer that is at least as large as DataLength, or specify MQGMO_ACCEPT_TRUNCATED_MSG if not all of the message data is required.
It doesn't look like there is any way I can use these options with the standard AMQSGET program - or is there? |
|
Back to top |
|
 |
Nathan |
Posted: Thu Sep 25, 2003 5:44 am Post subject: |
|
|
 Acolyte
Joined: 15 Sep 2003 Posts: 52 Location: Rochester, NY
|
If you don't mind doing the deletes manually, I would recommend getting the IH03 support pac. This is a very useful message tool. It has a clear queue function. Not to mention the many other capabilities. |
|
Back to top |
|
 |
olan022 |
Posted: Thu Sep 25, 2003 5:53 am Post subject: |
|
|
 Acolyte
Joined: 17 Apr 2002 Posts: 50
|
Thanks for the info, but I would like to have this triggered since this application can potentially generate upwards 80,000 messages to one queue very quickly and doing this manually isn't really a viable option. |
|
Back to top |
|
 |
Nathan |
Posted: Thu Sep 25, 2003 6:02 am Post subject: |
|
|
 Acolyte
Joined: 15 Sep 2003 Posts: 52 Location: Rochester, NY
|
wow, that is a lot of messages! I hope you can find a use for the IH03 tool anyway.
What OS are you trying to create the queue reader program on? |
|
Back to top |
|
 |
olan022 |
Posted: Thu Sep 25, 2003 6:10 am Post subject: |
|
|
 Acolyte
Joined: 17 Apr 2002 Posts: 50
|
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 25, 2003 6:14 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You should simply be able to modify AMQSGET to accept truncated messages. Then it will destructively read the message, and only keep the first piece of it that fits into the buffer it supplies.
If you set that buffer to be one byte, and then modify it to read every message in the queue, you should be good.
Or there might be a program in the repository here that does this already. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Nathan |
Posted: Thu Sep 25, 2003 6:20 am Post subject: |
|
|
 Acolyte
Joined: 15 Sep 2003 Posts: 52 Location: Rochester, NY
|
I have made some PERL scripts that have the function you are trying to get. But, yes, what JeffLowrey said should work for AMQSGET. |
|
Back to top |
|
 |
olan022 |
Posted: Thu Sep 25, 2003 6:24 am Post subject: |
|
|
 Acolyte
Joined: 17 Apr 2002 Posts: 50
|
You can do this using a MQGET call, but apparently not using an AMQSGET program. The AMQSGET program doesn't allow for those kind of options.
Now if I could program, I could write something with an MQGET with one of those options, unfortunately I don't know how to program that. |
|
Back to top |
|
 |
Nathan |
Posted: Thu Sep 25, 2003 6:37 am Post subject: |
|
|
 Acolyte
Joined: 15 Sep 2003 Posts: 52 Location: Rochester, NY
|
You will probably have to change the MQGMO_DEFAULT in this line. You will have to list all the settings you need.
Code: |
MQGMO gmo = {MQGMO_DEFAULT}; |
|
|
Back to top |
|
 |
olan022 |
Posted: Thu Sep 25, 2003 7:40 am Post subject: |
|
|
 Acolyte
Joined: 17 Apr 2002 Posts: 50
|
I'll have to take a crack at programming this. Thanks for your help guys! |
|
Back to top |
|
 |
Ratan |
Posted: Thu Sep 25, 2003 8:39 am Post subject: |
|
|
 Grand Master
Joined: 18 Jul 2002 Posts: 1245
|
You can use the 'Q' program which is available as a support pack to do a destructive get from the Queue. I dont remember the Support pack ID. I use it for a similar problem. _________________ -Ratan |
|
Back to top |
|
 |
olan022 |
Posted: Thu Sep 25, 2003 9:15 am Post subject: |
|
|
 Acolyte
Joined: 17 Apr 2002 Posts: 50
|
|
Back to top |
|
 |
|