'Spring Boot JMS: access receiveMessage() result via a (RxJava) subscription?

How can I access a JMS message receipt with e.g. 'receiveMessage( )' in a RxJava subscription like manner?

I don't want to do this in a callback style. I want to have the details of the implementation, like @JmsListener, to be hidden from the caller.

For example, I have a typical method called when there is a message available at a JMS queue.

@JmsListener(destination = "mailbox", containerFactory = "myFactory")
public void receiveMessage(Email email) {
    logger.info("Received <" + email + ">");
}

How can I access available messages via a (RxJava) subscription?

receiver.subscribe( message -> { ... }); 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source