The Top 7 Mistakes Newbies Make with Akka.NETは説明する:アッカ.NET PipeTo()()
[...]我々は、エンドユーザーがネストされた非同期の多くを開発参照/個々のメッセージハンドラ内で操作を待機します。ほとんどのユーザーは、これを行うために見過ごされるコストがあります。アクターは、待っているメッセージが元のメッセージの「一度に1つのメッセージ」の一部であるため、各操作の間に他のメッセージを処理できません。
はまだPetabridgeアッカ.NET合宿のUnit 3 Lesson 4に、この例では大丈夫と考えられている:私はこれを理解
// asynchronously download the image and pipe the results to ourself
_httpClient.GetAsync(imageUrl).ContinueWith(httpRequest =>
{
var response = httpRequest.Result;
// successful img download
if (response.StatusCode == HttpStatusCode.OK)
{
var contentStream = response.Content.ReadAsStreamAsync();
try
{
contentStream.Wait(TimeSpan.FromSeconds(1));
return new ImageDownloadResult(image,
response.StatusCode, contentStream.Result);
}
catch //timeout exceptions!
{
return new ImageDownloadResult(image, HttpStatusCode.PartialContent);
}
}
return new ImageDownloadResult(image, response.StatusCode);
},
TaskContinuationOptions.ExecuteSynchronously)
.PipeTo(Self);
方法、俳優がGetAsync()
まで、他のすべてのメッセージを処理することができず、 が完了しました。これはまさに問題です。回避しようとしていたPipeTo()
。
ここに何か不足していますか?
可能な重複http://stackoverflow.com/questions/28550275/async-api-call-アクター内外の例外) – tomliversidge