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
Choice
receivers on eachPortSet
, and in each handler toPost
to a completion port. On the completion port, you could use aJoin
when they all complete.So, off the top of my head, and assuming you are deriving fromCcrServiceBase
(otherwise you'll need to useArbiter.Activate
instead of the terserActivate
):If instead you had a common
Response
type, you could instead structure your calls as follows:so instead of the
GetData
call creating a newPortSet
, you provide a commonPortSet
and supply it to theGetData
methods.Now, you can perform a multiple item receive: