Here's the official sample of using PipeTo()
in Akka.NET:
Receive<BeginProcessFeed>(feed =>
{
//instance variable for closure
var senderClosure = Sender;
SendMessage(string.Format("Downloading {0} for RSS/ATOM processing...", feed.FeedUri));
//reply back to the sender
_feedFactory.CreateFeedAsync(feed.FeedUri).PipeTo(senderClosure);
});
The question is why should we use Sender
closure here? Why not to use just:
_feedFactory.CreateFeedAsync(feed.FeedUri).PipeTo(Sender);
In this sample and in the docs it's said it's mandatory to use closure here. But I don't see any reasons to do so.
If we used ContinueWith()
it's reasonable to use closure inside the continuation, but not as PipeTo()
parameter.
Do I miss something?