This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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