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

Return the message in an error if it failed to be sent #75

Open
bschwind opened this issue Mar 20, 2023 · 1 comment
Open

Return the message in an error if it failed to be sent #75

bschwind opened this issue Mar 20, 2023 · 1 comment

Comments

@bschwind
Copy link
Member

Flume has a TrySendError which returns the message that we attempted to send.

We should surface this to our API so actors can decide what to do with the message if it failed to send.

This might create an explosion of generics so let's approach this carefully.

@strohel
Copy link
Member

strohel commented Mar 20, 2023

Yeah this may end up being a bit tricky in current type design of actor:

We allow infinite Recipient<T> -> Recipient<U> -> Recipient<V> conversions provided the messages can be converted (V -> U -> T). But we don't want to add the bound in the other direction (T -> U), as that might not be possible for user to fullfil at all.

So our Recipient<V> cannot return SomeError<V>, and it also cannot return SomeError<T>, because the whole point of Recipient is to erase the T generic parameter.

It could return Box<dyn Any>, but that would incur the boxing costs on all failures to send (some users may send large volume of big messages that are largely dropped, and don't care about it).

Maybe there is some other way, perhaps registering some form or callback etc.

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

No branches or pull requests

2 participants