I have 4 services, each has a method with the signature like this:
PortSet<Response1, Exception> GetData1(Request1 request);
PortSet<Response2, Exception> GetData2(Request2 request);
PortSet<Response3, Exception> GetData3(Request3 request);
PortSet<Response4, Exception> GetData4(Request4 request);
I need to run them concurrently and join the final result, processing result and exception that comes from each port separately. Could you please suggest how do I do this?
I was able to find only possibility to join the results from the Port's, not from PortSet's.
Thanks
Your solution is somewhat limited by the number of classes involved. I'd suggest activating
Choicereceivers on eachPortSet, and in each handler toPostto a completion port. On the completion port, you could use aJoinwhen they all complete.So, off the top of my head, and assuming you are deriving fromCcrServiceBase(otherwise you'll need to useArbiter.Activateinstead of the terserActivate):If instead you had a common
Responsetype, you could instead structure your calls as follows:so instead of the
GetDatacall creating a newPortSet, you provide a commonPortSetand supply it to theGetDatamethods.Now, you can perform a multiple item receive: