Send / Reply

Jul 16, 2009 at 10:46 AM

Is the default way of handeling a basic send / reply communication protocol the publisher / subscription model? This implies having a subscription (with filter to publish only to the sending client) for every message send which is less than ideal.

Coordinator
Jul 16, 2009 at 1:22 PM

Of course pub/sub is not the means to model request/response communication. Rather the sender should send a reply-port to the receiver, e.g.

class Request
{
  ...
  public Port<string> Reply;
}
...
var pReply = new Port<string>();
space.Receive(pReply, ...);

worker.Post(new Request { ..., Reply=pReply });

The receiver then can individually answer each request:

void ProcessString(Request req)
{
  ...
  req.Reply.Post(...);
}

This is a basic CCR pattern. It hasn´t much to do with the AppSpace.

-Ralf

Jul 16, 2009 at 9:29 PM

That is very nifty! I did not realize the port inside the message will persist accross the communication channels.

Coordinator
Jul 16, 2009 at 9:56 PM

Sure it does :-) That´s one of the great features of the AppSpace. The same is true for CCR causalities.

-Ralf