You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a message is forwarded (<<!) within an async block, forwardee.Sender() returns the deadLetters actor, hence the real sender cannot received any message back from the forwardee.
It works fine when the message is forwarded synchronously.
It seems to be a thread issue.
Indeed, it works OK when forwarding inside a task {} block instead of an async {} block.
I will need to replace all my async {} with task {} :(
As the Task API seems more robust/battle tested than the Async one, is it planned to replace all Async functions with Task functions in Akkling ? (the <? operator in particular)
I don't mind doing it, it would however break compatibility with existing API. Perhaps we could put Async/Task related APIs into their respective modules and let people choose for their own.
Indeed, it's a shame that an Async can't bind to a Task, while the opposite is possible.
It may be added in a future version of F#, but in the meantime maybe Akkling could extend AsyncBuilder and add a Bind(Task<>) method ?
[<AutoOpen>]
module AsyncExtensions =
type AsyncBuilder with
member __.ReturnFrom(task: Task<'T>) : Async<'T> =
Async.AwaitTask task
member this.Bind(task: Task<'T>, binder: 'T -> Async<'U>) : Async<'U> =
this.Bind(Async.AwaitTask task, binder)
This way, Akkling could define only Task<> returning functions, avoiding all the existing roundtrips Async->Task->Async with Async.AwaitTask and Async.StartAsTask everywhere in the code for Akka.NET interop.
The user could then equally call those functions inside a task {} or an async {} block.
When a message is forwarded (<<!) within an async block, forwardee.Sender() returns the deadLetters actor, hence the real sender cannot received any message back from the forwardee.
It works fine when the message is forwarded synchronously.
Attached is a project to demonstrate the bug.
DeadLetterBug.zip
The text was updated successfully, but these errors were encountered: