Friday, February 13, 2015

A schedule 'OrchestrationName' with parameters cannot have an activatable receive

Scenario is simple, I receive a message and depending upon value present in the distinguished field I had to call a child Orchestration, which will do its intended job and return me back the result (Synchronous call). Below is what I encountered:



Why it happened:


As can be seen from image below, I had created an Orchestration Parameter (although by mistake ;) ) .



So what’s wrong in this?

The error says that if you have defined an Orchestration parameters then it can’t have a receive shape with Activate property set to true.

Why So?

Defining parameters is allowed only in the Orchestration which are to be started/called(Child) from some other Orchestration(Parent). Thus the invocation of such orchestrations does not happen with the Receive shape which is looking out for the message it is configured to, instead it is based on the parameters which is defined in it. So if there is requirement where an Orchestration needs to serve as child orchestration then remember you can't use receive shape to start the process and where an Orchestration is supposed to be started by Receive shape, you can't define parameters.

What if I need to call A->B and B-> C,  B is parent to C?

In this case it will work provided that Activation set to false—that is, only orchestrations that are invoked from another process—will be available for selection, as B is child orchestration to A and it gets instantiated with parameters so even though it is parent to C, it is not activated by Receive shape.


What to do:

Remove the parameter else you won’t be able to compile as having a parameter in Parent orchestration which is instantiated with Receive shape contradicts to the way it is designed to work.  

2 comments:

  1. All the receive ports after the first one must be set to inactive.

    ReplyDelete