THOUGHTSTORMING: allow attaching of meta-information to sender reference
The question about message converters made me think: given an actor A which transforms requests, sends to B, receives replies, transforms them and sends them back to the original sender. This breaks down when there are multiple senders and the sender cannot be embedded within the message (fixed protocol). In that case the closest solution is to spawn one actor per sender, keep them in a map and use these for transforming and routing the replies.
This could in principle be avoided if the sender reference would carry some meta-information. Attaching it to the sender and not to the Envelope means that forwarding messages works, even to multiple destinations, while retaining the information at the “right” spot. We might use the query part of the URI for this (currently simply disallowed):
When a reply is sent to this address, the “forwarder” actor could retrieve the meta-info and route the reply to the “client”.
IMPACT
This is of course not free: we would need to store the recipient address in the Envelope, which would typically be the same object as the actor’s path, but could potentially differ. In practice we would probably just extract the meta-info and store that or null, but the extra field is needed. And of course there would need to be an accessor method and an underlying field which is potentially set upon each message processed.
This could in principle be avoided if the sender reference would carry some meta-information. Attaching it to the sender and not to the Envelope means that forwarding messages works, even to multiple destinations, while retaining the information at the “right” spot. We might use the query part of the URI for this (currently simply disallowed):
akka://sys@host:port/user/service/forwarder?orig=akka://other@host2:port/user/client
When a reply is sent to this address, the “forwarder” actor could retrieve the meta-info and route the reply to the “client”.
IMPACT
This is of course not free: we would need to store the recipient address in the Envelope, which would typically be the same object as the actor’s path, but could potentially differ. In practice we would probably just extract the meta-info and store that or null, but the extra field is needed. And of course there would need to be an accessor method and an underlying field which is potentially set upon each message processed.
Leave a comment
on 2012-01-03 02:05 *
By viktorklang
I think spawning a new Actor is the right thing to do. See it as creating a conversational context.
on 2012-10-26 22:26 *
By viktorklang
Summary changed from allow attaching of meta-information to sender reference to THOUGHTSTORMING: allow attaching of meta-information to sender reference