Author |
Message
|
5zan |
Posted: Tue Jul 15, 2008 10:06 pm Post subject: My own Back out count |
|
|
Novice
Joined: 08 Jul 2008 Posts: 24
|
i am using the error handling sub flow (EHSF)
from the main flow my control goes to the EHSF , if there is any msg at the failure or catch terminals .
i want to implement my own backout count ( not using the MQMD backout count ) in the EHSF ..
now when my message comes into the flow for the first time i need to set it in the environment variable once , but in the subsequent retries coming in again in the same flow i just need to increment it untill a limit is reached ..
ANY SUGGESTED LOGIC ?
DO I NEED TO USE THE ATOMIC STATEMENT ?  |
|
Back to top |
|
 |
AkankshA |
Posted: Tue Jul 15, 2008 10:26 pm Post subject: Re: My own Back out count |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
5zan wrote: |
DO I NEED TO USE THE ATOMIC STATEMENT |
I don think u need atomic here in this case....
5zan wrote: |
ANY SUGGESTED LOGIC ? |
You just specified the most suitable logic one can think of...
but beware it would consume resources and keeping a high back out count would put delay in processing of rest of messages... manage your SLA's accordingly.. _________________ Cheers |
|
Back to top |
|
 |
5zan |
Posted: Tue Jul 15, 2008 11:08 pm Post subject: |
|
|
Novice
Joined: 08 Jul 2008 Posts: 24
|
heres my logic :
DECLARE Bcount INTEGER 0 ;
IF Environment.variables.BCOUNT >=1 THEN
SET Environment.variables.BCOUNT = Environment.variables.BCOUNT +1 ;
ELSE
SET Environment.variables.BCOUNT =1;
END IF ;
SET Bcount = Environment.variables.BCOUNT ;
If Bcount >= BACK_COUNT_LIMIT THEN
RETURN TRUE;
ELSE
SET Environment.variables.BCOUNT = Bcount + 1;
RETURN FALSE ;
END IF ;
please copy it into a notepad if u want for clarity .
i think there is a flaw , beacuse i am not sure what is the initial value set to an environment variable . i dont think so it is 0 ...
so i think the logic fails ..
please comment . |
|
Back to top |
|
 |
AkankshA |
Posted: Tue Jul 15, 2008 11:18 pm Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
code should be something like this : pls check for sysntax , they might be wrong..
IF Environment.variables.BCOUNT IS NULL
then
SET Environment.variables.BCOUNT = '0';
end if;
DECLARE Bcount INTEGER;
SET Bcount = Environment.variables.BCOUNT ;
If Bcount = BACK_COUNT_LIMIT THEN
SET Environment.variables.BCOUNT = Bcount + 1;
RETURN TRUE;
ELSE
RETURN FALSE ;
END IF ;
You will loose the message when it reaches backout threshold.. no furrther propagation _________________ Cheers |
|
Back to top |
|
 |
5zan |
Posted: Tue Jul 15, 2008 11:55 pm Post subject: |
|
|
Novice
Joined: 08 Jul 2008 Posts: 24
|
Thanx , but it still dosent work coz while switching from main flow to sub flow i loose the environment variables ...
i think shared variable here is a must , but then again its life is for the life time of the EG ..
me in a TIZZY !!  |
|
Back to top |
|
 |
AkankshA |
Posted: Tue Jul 15, 2008 11:58 pm Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
5zan wrote: |
Thanx , but it still dosent work coz while switching from main flow to sub flow i loose the environment variables ...
i think shared variable here is a must , but then again its life is for the life time of the EG ..
me in a TIZZY !!  |
You dont loose env tree when you switch from main flow to subflow... subflows are deployed as part n parsel of main flow and the tree structure stays...
What error do you get ?? did you try checking for the flow in debug mode ??
I hope you have not deployed subflow as a separate flow and involved MQ here.. _________________ Cheers |
|
Back to top |
|
 |
5zan |
Posted: Wed Jul 16, 2008 12:08 am Post subject: |
|
|
Novice
Joined: 08 Jul 2008 Posts: 24
|
THIS works , but am still testing to find any flaw ...
also lemme know if u find any thing wrong ..
also in case of success i am resetting the shared variable ..
declare sharecount shared integer 0 ;
IF SHARECOUNT >=1 THEN
ELSE
SET SHARECOUNT = SHARECOUNT + 1;
END IF ;
If SHARECOUNT >= BACK_COUNT_LIMIT THEN
SET SHARECOUNT = 0 ;
RETURN TRUE; --limit reached, send to bad message queue--
ELSE
RETURN FALSE ;
END IF ; |
|
Back to top |
|
 |
5zan |
Posted: Wed Jul 16, 2008 12:33 am Post subject: |
|
|
Novice
Joined: 08 Jul 2008 Posts: 24
|
yes i tried , the Env tree is lost while bouncing back to the main flows input node ... i verified that in the debugger ..
maybe if the control is passed from somwhere other than input node the tree survives ...
correct me if m wrong , but dats what i saw ! [/list][/quote] |
|
Back to top |
|
 |
AkankshA |
Posted: Wed Jul 16, 2008 1:13 am Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
5zan wrote: |
yes i tried , the Env tree is lost while bouncing back to the main flows input node ... i verified that in the debugger ..
maybe if the control is passed from somwhere other than input node the tree survives ...
correct me if m wrong , but dats what i saw ! [/list] |
[/quote]
this is right..
This happens when we have the MQOutput node directly attached to compute node... in thsi case whenever the exception happens.. the entire transaction gets rolled back and message is sent to input node exception terminal..
so when you ll try it second time entire flow would be repeated..
However if you use try catch pair before MQOutput, your transaction would survive and stay committed irrespective of failure at the last node... _________________ Cheers |
|
Back to top |
|
 |
5zan |
Posted: Wed Jul 16, 2008 4:44 am Post subject: |
|
|
Novice
Joined: 08 Jul 2008 Posts: 24
|
yes thats right ! |
|
Back to top |
|
 |
|