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

Subscriber payload or contextualize request #542

Open
victorherraiz-santander opened this issue Oct 29, 2022 · 4 comments
Open

Subscriber payload or contextualize request #542

victorherraiz-santander opened this issue Oct 29, 2022 · 4 comments

Comments

@victorherraiz-santander
Copy link

victorherraiz-santander commented Oct 29, 2022

Have you ever consider adding payload to subscribe method on the publisher? Subscriptions move upstream and it could be useful to have something that carries data and it is visible in the API.

Another option could be to add some context to the request method in the subscription.

@jponge
Copy link

jponge commented Oct 31, 2022

It's something that implementations can support in a ad-hoc fashion (see https://smallrye.io/smallrye-mutiny/1.7.0/guides/context-passing/ in Mutiny) but IMHO the RS APIs should not define context passing.

@victorherraiz-santander
Copy link
Author

Several real world scenarios require non-functional data (e.g. security context). Reactive implementations are compatible but ad-hoc implementations to provide an execution context could clash, leave some important data behind or even fail to clean up properly. In my opinion, define a payload in the subscription and the semantics for moving the data upstream could help to normalise context passing and make the implementation more transparent.

@akarnokd
Copy link
Contributor

Is it mutable or immutable context? How is it supposed to travel to multiple sources? Are there lifecycle considerations of the context?

I have thought about many extension direction to RS years ago but almost always I ended up building upon RS as it is.

Therefore, I suggest you prototype your ideas and implement a few non-trivial operators (flatMap, publish) to see if it works out or not.

@victorherraiz-santander
Copy link
Author

@akarnokd @jponge thank you for your interest!

In my opinion the context should be immutable and could be decorated by operators/processors. I like how they expose context in CoreSubscriber from reactor project.

I did some prototypes years ago to understand better how reactive specs works, but I always end up using a library. You are right @akarnokd, I will try to do a PoC with some operators and try to see how it works, especially when I move between java Flow and reactive stream interfaces.

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

3 participants