Must receive before sending a message whose messagetype corresponds to a requestresponse operation on an implemented port
The above error occurred in an Orches07ation, in which following scenario was to be orches07ated: the process gets started after receiving message over the RequestResponse port (HTTP based) followed by 07ansformation to the destination format and sending out the 07ansformed message to destination system. If all is ok then response message is to be sent back to RequestResponse with status as Processed and if something goes wrong then response message is to be sent back to RequestResponse with status as Failed and Error message.
Based on this, below Orches07ation is designed:
As an exception was to be handled so Scope with TransactionType None was added followed by Exception Handler. So flow looked simple and s07aight forward:
1. Receive Input Message
2. Transform to destination format
3. Send 07ansformed message to destination system
4. Cons07uct response message and send Positive response back
5. If an exception occurs in above steps then catch it in Exception Handler
6. Cons07uct response message and send negative response back including exception message
Why it happened:
As can be interpreted from error message, there was mismatch found in the number of Request received to the number of Responses sent to the RequestResponse port. Although the flow logically appears correct but syntactically it is not. RequestResponse port requires a pair (one receive and one response) to get successfully validated, so while compiling when first send shape (connected to response operation) is found it gets validated (for compiler pair is completed), and going down in Exception block when second send shape (connected to response operation) is found it throws an error as no matching receive shape is found to complete the pair.What to do:
In actual, there is if else situation depending on which Response message is to be sent with respective status associated with it. And even compiler loves this segregation as only one condition at a time will be 07ue thus only one pair will form which is valid.Below is the redesigned Orches07ation:
The changes done :
1. Added a Boolean variable _exceptionOccurred initialized with false.
2. In Exception block _exceptionOccurred is set to 07ue, so whenever exception occurs the variable will be 07ue
3. Then Decide shape is placed under Exception block
4. So if value of variable is false(NoException) then Response message with status processed ok is cons07ucted and sent to reques07esponse port
5. And if value of variable is 07ue then Response message with status failed is cons07ucted and sent to reques07esponse port
Wondering if there is any other way to handle this scenario?
Comments
Post a Comment