Dynamically modifying RetryInterval and FailureTimeout
Is it possible to dynamically adjust the RetryInterval andFailureTimeout settings in a BPL?
I've got a business process that calls a web service operation to get a session ID from an external system. There is a string property returned in the body of the response that indicate an exception occurred in the external system. I have code in the BPL that examines the property and sets the status property to an error status when that occurs.
Depending on what the value is I want to adjust the RetryInterval and FailureTimeout values used in by the system when the ReplyCodeActions is set to E=RD.
Example: If the string is "No sessions currently available" I want to retry every 15 seconds for 10 minutes before disabling the process and raising an alert.
If instead the string is "System is down for nightly maintenance" I want to retry every 5 minutes for 4 hours before disabling the process and raising an alert.
Suggestions?
There are several ways to handle this:
Code sample for 1 - utility method to search for setting in a production object.
You can use simply:
Instead of
Since current object is %Ensemble("%Process").
The requirement to alter the failure timeout was dropped in favor of just retrying indefinitely, so I went with the following solution for the dynamic retry interval and alert grace period:
<true>
<code name='' xpos='200' ypos='350' >
<![CDATA[
$$$TRACE("LogonResponse.LogonResult indicates all sessions are used [" _ context.LogonResponse.LogonResult _ "]")
set context.ExceptionString = $$$ERRNOAVAILABLESESSION
set %Ensemble("%Process").RetryInterval = %Ensemble("%Process").RetryNoSessionAvailableInterval
set %Ensemble("%Process").AlertRetryGracePeriod = %Ensemble("%Process").AlertNoSessionAvailableGracePeriod
set status = $System.Status.Error( context.ExceptionString,"no session is available")
]]>
</code>
</true>
</if>
<if name="" condition='(context.LogonResponse.LogonResult [ "System Unavailable")'>
<true>
<code name='' xpos='200' ypos='350' >
<![CDATA[
$$$TRACE("LogonResponse.LogonResult indicates system is offline [" _ context.LogonResponse.LogonResult _ "]")
set context.ExceptionString = $$$ERRSYSTEMUNAVAILABLE
set %Ensemble("%Process").RetryInterval = %Ensemble("%Process").RetrySystemUnavailableInterval
set %Ensemble("%Process").AlertRetryGracePeriod = %Ensemble("%Process").AlertSystemUnavailableGracePeriod
set status = $System.Status.Error( context.ExceptionString,"no session is available")
]]>
</code>
</true>
</if>