Hi all

At times you may run into this error at compile time: “an atomic scope may not contain
a receive with a correlation filtration initialized in the same scope”. Not very many
posts exist on this topic so I thought I’d just share some thoughts on it.

First of all, the error occurs because you have a Receive shape inside an atomic scope
and this Receive shape follows a correlation set that is initialized within the same
scope. This is not allowed, as explained here: http://msdn.microsoft.com/en-us/library/aa560115(BTS.10).aspx.

The reason for this limitation is, that everything that happens inside the Atomic
scope is not committed until the Scope shape finishes processing. If you at some point
initialize a correlation set inside the Atomic scope, then the subscriptions for any
Receive shapes that follow this correlation set cannot match the properties from the
correlation type because the routing engine cannot know about the values until the
Atomic transaction is committed.

If you actually could follow a correlation set that is initialized within the same
Atomic scope you would end up in a deadlock because:

  1. The instance subscription is not created until the transaction commits
  2. The transaction does not commit until the Receive shape has its message

So as you can see, the Receive shape would never get a message and therefore the transaction
would never commit.

Hope this helps someone out there.



eliasen