|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
ATOMIC BLOCK Question |
« View previous topic :: View next topic » |
Author |
Message
|
Cho Chul-hwan |
Posted: Thu May 09, 2013 9:16 pm Post subject: ATOMIC BLOCK Question |
|
|
Newbie
Joined: 05 May 2013 Posts: 8
|
Hi~
recently, I started WMB 7.0
i get DB data using shared row and i use ATOMIC block
but every time statement execute in atomic block
here is my code :
---- Module Begin ----
... (other code)
vanRoute : BEGIN ATOMIC
CALL getVanRouteInfoFromDb();
END vanRoute;
...(other code)
---- Module End -----
I want to execute just one at first message is sented
how to implement?
please help me....
and i'm not good at english so, the sentence is not perfect.^^;; |
|
Back to top |
|
 |
huwgb |
Posted: Thu May 09, 2013 9:36 pm Post subject: |
|
|
Novice
Joined: 07 May 2013 Posts: 21
|
From my understanding you wish to do the following:
Send many messages to message flow
Have special processing in the database the first time a message hits the flow
Ignore the database processing for following messages...
ATOMIC means that when multiple instances of a flow are deployed, only one instance at a time will have access to that code block, the others will wait until that instance has finished.
This can be done by adding a new GLOBAL SHARED VARIABLE at the end of the ATOMIC block.
Code: |
DECLARE hasBeenRun SHARED BOOLEAN;
IF NOT hasBeenRun THEN
vanRoute : BEGIN ATOMIC
CALL getVanRouteInfoFromDb();
SET hasBeenRun = TRUE;
END vanRoute;
END IF; |
Note, this code has not been tested and I can not guarantee I got the syntax correct, look up global shared variables for some hints.
Also Note:
If the message flow is restarted or the execution group is restarted, the variable will be set to false so the getVanRouteInfoFromDb statement will be called again |
|
Back to top |
|
 |
Cho Chul-hwan |
Posted: Thu May 09, 2013 11:18 pm Post subject: Thank you |
|
|
Newbie
Joined: 05 May 2013 Posts: 8
|
Thank you for your answer.
it is helpful for me to understand Atomic Block. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|