Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the replyTo pattern for Register messages #1514

Merged
merged 3 commits into from
Sep 1, 2020
Merged

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Aug 13, 2020

In preparation of the migration to typed actors, we need to remove the
use of sender, which doesn't exist in typed actors (and even returns
dead letters when mixing typed/untyped actors).

This also means that, in the tests, we should stop using the
TestProbe.send() method, which also relies on the recipient replying
to sender. Instead, we should use targetActor ! msg which guarantees
that the sender is void.

Using the replyTo pattern doesn't mix well with the ask pattern,
because we don't know the reference to the temporary actor. To deal with
that, we set replyTo = ActorRef.noSender which is a bit hackish.

NB: the akka doc shows the proper way of dealing with ask with typed actors:

val result: Future[CookieFabric.Reply] = cookieFabric.ask(ref => CookieFabric.GiveMeCookies(3, ref))

@pm47 pm47 requested a review from t-bast August 13, 2020 12:17
@pm47 pm47 changed the title Add replyTo to Register messages Use the replyTo pattern for Register messages Aug 20, 2020
@pm47 pm47 force-pushed the register-replyto branch 2 times, most recently from 51d06d7 to d49e3a0 Compare August 28, 2020 15:19
pm47 and others added 3 commits September 1, 2020 16:00
In preparation of the migration to typed actors, we need to remove the
use of `sender`, which doesn't exist in typed actors (and even returns
dead letters when mixing typed/untyped actors).

This also means that, in the tests, we should stop using the
`TestProbe.send()` method, which also relies on the recipient replying
to `sender`. Instead, we should use `targetActor ! msg` which guarantees
that the sender is void.

Using the `replyTo` pattern doesn't mix well with the `ask` pattern,
because we don't know the reference to the temporary actor. To deal with
that, we set `replyTo = ActorRef.noSender` which is a bit hackish.
Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
@pm47
Copy link
Member Author

pm47 commented Sep 1, 2020

Rebased

@pm47 pm47 merged commit ef1bf0b into master Sep 1, 2020
@pm47 pm47 deleted the register-replyto branch September 1, 2020 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants