Chapter 9. Scenario: Asynchronous callback 305
InitVar node
The InitVar Compute node saves the counter and the RequestURL (set by the
SRRetrieveITService node) to the SOAP Envelope header (Example 9-4).
Example 9-4 Saving the counter and request URL
CREATE COMPUTE MODULE ErrorHandleFlow_InitVar
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyEntireMessage();
--SET Environment.Counter = 0;
SET OutputRoot.XMLNS.soapenv:Envelope.soapenv:Header.Counter = 0;
SET OutputRoot.XMLNS.soapenv:Envelope.soapenv:Header.RequestURL =
InputLocalEnvironment.Destination.HTTP.RequestURL;
RETURN TRUE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
Increment node
The Increment Compute node checks the number of retries. If the counter
exceeds the maximum number of retries, the output is propagated to a Compute
node that puts the message in the FAILUIREQ. If the counter does not exceed
the limit, it is incremented by one and the request timeout is set for the
TimeoutNotification node. See Example 9-5.
Example 9-5 Checking and incrementing the retry counter
CREATE COMPUTE MODULE ErrorHandleFlow_Increment
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyEntireMessage();
-- Remove the HTTP response header because its presence causes
problem in TimeOut control processing
SET OutputRoot.HTTPResponseHeader = NULL;
-- Check the number of retries
Important: The counter and the RequestURL are saved in the SOAP
Envelope header and not the Environment because the TimeoutNotification
node preserves the message and TimeoutRequest only.