Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Setup connector
JmsConnector seConn = JmsConnector.create();
// Prepare channels
Channel<String> toJms = Channel.create("to-jms");
Channel<String> fromJms = Channel.create("from-jms");
// Prepare emitter for interaction with non-reactive code
Emitter<String> emitter = Emitter.create(toJms);
// Connect everything together
Messaging.builder()
.config(Config.builder()
.sources(() -> FileConfigSource.builder()
.path(Paths.get("src/main/resources/application.yaml"))
.build()
)
.build()
)
.connector(seConn)
.emitter(emitter)
.listener(fromJms, s -> {
System.out.println("Message received: " + s);
})
.build()
.start();
// Manually send some messages
emitter.send("Hello");
emitter.send("world");
emitter.send("from");
emitter.send("Active");
emitter.send("MQ!");
// Don't forget to wait for messages to arrive asynchronously!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment