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

Reactive messaging Emitter<T> interface is missing Mutiny integration #11572

Closed
vankofalcon opened this issue Aug 24, 2020 · 10 comments · Fixed by #12470
Closed

Reactive messaging Emitter<T> interface is missing Mutiny integration #11572

vankofalcon opened this issue Aug 24, 2020 · 10 comments · Fixed by #12470

Comments

@vankofalcon
Copy link

vankofalcon commented Aug 24, 2020

Quarkus version: 1.7.0

package org.eclipse.microprofile.reactive.messaging;

Why does the Emitter interface has only the CompletionStage send(T msg) method and is missing Uni and Multi send overloads?

As shown here I can consume the messages using mutiny types https://smallrye.io/smallrye-reactive-messaging/smallrye-reactive-messaging/2/emitter/emitter.html#streams

@Inject @Channel("my-channel") Multi<String> streamOfPayloads;

But I can only send them using the Emitter that doesn't understand mutiny

CompletionStage<Void> send(T msg)

@quarkusbot
Copy link

@kenfinnigan
Copy link
Member

kenfinnigan commented Aug 24, 2020

What is it you're trying to do?

I'm still learning a lot of this but I'm not sure it makes sense for a single emit event to return a Multi type

@vankofalcon
Copy link
Author

Hi @kenfinnigan
I want to be able to use Mutiny all over my code base.

  1. Emitter send method that return Uni makes sense right?
  2. Multi would also make sense if you want to emit a batch of items in a reactive fashion. I hope that I'm not totally wrong about this

@kenfinnigan
Copy link
Member

Possibly for 1, but I think there are methods to create a Uni from a CompletionStage.

For 2, right now the emitter sends a single message at a time, I don't believe there is the concept of sending a batch of messages at once. That would require changes to SmallRye Reactive Messaging to support it.

However, if what you want to do is have a stream that emits a message as new things come through the pipeline, I believe that is achievable today. It would mean having a Multi that receives data and then invoking the send on the emitter as part of the pipeline.

I could be wrong, but that's my understanding

@vankofalcon
Copy link
Author

vankofalcon commented Aug 24, 2020

All the things you said make sense. Don't you think that it will be more consistent if the sending of a message also support Mutiny out of the box? As I have already pointed out the consuming of a message has a first class Mutiny support https://smallrye.io/smallrye-reactive-messaging/smallrye-reactive-messaging/2/emitter/emitter.html#streams

@kenfinnigan
Copy link
Member

What would you consider supporting Mutiny in the emitting of messages as well?

Is it returning Uni and Multi, is it taking them as parameters, or something else?

@vankofalcon
Copy link
Author

As you said Multi might not be OK. So at least returning Uni<Void>,
that will be an alternative for CompletionStage<Void> send(T msg); in the Emitter interface

@kenfinnigan
Copy link
Member

Please raise an issue here: https://github.com/smallrye/smallrye-reactive-messaging/issues

It can then be discussed and implemented

@vankofalcon
Copy link
Author

vankofalcon commented Aug 24, 2020

@kenfinnigan
Copy link
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants