Bridge JMS Message to SSE Endpoint in Quarkus

In Spring project, I used Sinks to emit events into a SSE endpoint, it worked well, check:

But when I tried to Smallrye Mutiny MultiEmitterProcessor to archive the same purpose, it failed.

The example project is

    MultiEmitterProcessor<Message> emitterProcessor = MultiEmitterProcessor.create();

    void receive() {
        var consumer = jmsContext.createConsumer(helloQueue);
                msg -> {
                    try {
                        var received = jsonb.fromJson(msg.getBody(String.class), Message.class);
                        LOGGER.log(Level.INFO, "consuming message: {0}", received);
                    } catch (JMSException e) {
                        throw new RuntimeException(e);

And in the Resource class,

    public Multi<Message> stream() {
        // see:
        return handler.emitterProcessor.toMulti().toHotStream();
  1. I am not sure MultiEmitterProcessor is good to work as a hot stream?

  2. or there are something like Reactor ConnectableFlux to connect to a hot stream manually?


  • Finally, I move the following codes from Resource class


    into a method in the handler class, then it works.

    public Multi<Message> stream() {
        return processor.toMulti().broadcast().toAllSubscribers();

    Check the final working example: