Regarding Re-use of Context-aware Proxies

Yesterday, following my "What’s the context for this conversation" presentation, I was approached with the following question:

I am sharing a singleton client that I want to use to interact with multiple workflow instances, how do I change the context for each of them.

Completely unbeknownst to me, Wenlong, one of the product team’s more prolific bloggers, addressed this very topic in his post here, conveniently posted yesterday :-)

Comments (1)

  1. igormoochnick says:

     How to execute HandleExternalActivity in the correct instance/context? What is the difference between the instance and the context?

     I know that I need to specify the instance GUID (via ExternalDataEventArgs) when I rase event, but I can’t figure out how I make sure that that a couple of different instances are active to process requests from different clients? or should I talk about contexts?

    The use case is very simple: I have a TCPListener (a server) that wants to instantiate a different instance of a state machine/workflow for each and every new client that connects to it. I bunch of articles mention that only one instance of the workflow should be created per AppDomain, but later this restriction was removed. Should I create an instance for each client or there is a way to create somehow a different processing context for each one of them? If I should talk about contexts – then how does my RaseEvent can make sure that it rases the next event to a correct context?

     Thanks a lot.