Author |
Message
|
James_O_K |
Posted: Mon Jun 19, 2006 7:45 am Post subject: How to do get commit in multi thread environment. |
|
|
Apprentice
Joined: 09 Mar 2006 Posts: 39 Location: UK
|
Hello all,
Ive got an MQ listener app that polls a queue getting messages from it. It then spawns a thread to deal with the message and do some backend work before sending a reply message.
At the moment I do a destructive MQGET on every message, what I would like to do on certain messages is a get and then a commit. Looking at using SYNCPOINT it seems as though you just commit the get after popping the message, this is not suitable because of multi threading, so ideally I would like to be able to specify the message ID of the message I would like to pop off the queue.
Would I do this using an MQ browse and some kind of cursor? Does anyone have any sample code.
Thanks all
James. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jun 19, 2006 7:48 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You don't need to use browse. You can use regular syncpoint.
You just have to think a bit about how many messages will be in the syncpoint, and when you will be committing them.
The easiest way to do this is actually have each thread doing it's own get. Then you don't have to worry about synchronizing the commit across threads. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
8davitt |
Posted: Tue Jun 20, 2006 5:11 am Post subject: |
|
|
Apprentice
Joined: 06 Feb 2003 Posts: 37 Location: Seated in front of monitor
|
|
Back to top |
|
 |
James_O_K |
Posted: Tue Jun 20, 2006 5:52 am Post subject: |
|
|
Apprentice
Joined: 09 Mar 2006 Posts: 39 Location: UK
|
jefflowrey wrote: |
You don't need to use browse. You can use regular syncpoint.
You just have to think a bit about how many messages will be in the syncpoint, and when you will be committing them.
The easiest way to do this is actually have each thread doing it's own get. Then you don't have to worry about synchronizing the commit across threads. |
Very good point, just unfortunate most of the message handler is already written!! |
|
Back to top |
|
 |
James_O_K |
Posted: Tue Jun 20, 2006 5:55 am Post subject: |
|
|
Apprentice
Joined: 09 Mar 2006 Posts: 39 Location: UK
|
Looks like a very useful doc. Thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 20, 2006 6:01 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
|