Thursday, June 2, 2011

When are Instance Subscriptions created, after all?

I stumbled with a situation where a Main orchestration calls a sub-orchestration, and this sub-orchestration sends back to Main a new message, using Direct Binding. The non-obvious behavior here is that the first Orchestration calls the second synchronously, so in theory the send in the second should fail, because the subscription is not there yet.

Since I knew that publishing with Direct Binding fails the sender orchestration if there is no subscription, I did a small test to check what was happening.

This is the main orchestration:

orch_main

The first Send initializes a correlation set, and the second receive follows it. The Main Orchestration passes the initially received message as a parameter to the sub-orchestration, which simply maps it into a new one and returns the result:

orch_sub

I deployed this and did a Search for subscriptions in the Administration Console. The result is curious: the subscription for the Reply message (the result of the map) is not there yet when at “Wait 1”, but it’s created after the correlation set is created, so its there when “Wait 2” is reached. This is why the publish in the sub-orchestration doesn’t actually fail.

This behavior might be different in some cases, as reported here by Yossi: When is a subscription created for a correlation set passed as a parameter?.

No comments:

Post a Comment