Replies: 1 comment 5 replies
-
You don't implement or create Here's a quick JBang script you might use to see how it works with Vert.x + Mutiny: ///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.smallrye.reactive:smallrye-mutiny-vertx-core:2.27.0
import io.vertx.mutiny.core.Vertx;
public class Check {
public static void main(String... args) {
var vertx = Vertx.vertx();
var bus = vertx.eventBus();
bus.<String>consumer("a.b.c").handler(message -> {
System.out.println(message.address());
System.out.println(message.replyAddress());
System.out.println(message.body());
message.reply("Hello " + message.body());
});
// Note that this is a blocking call!
var response = bus.<String>requestAndAwait("a.b.c", "you");
System.out.println(response.body());
}
} |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. I am quite new to Java and hence Mutiny so this might be a dumb question, however, I am stuck.
I have a Uni pipeline and in one stage I return the result of an EventBus.request() like so:
so the subsequent stage gets an item of type
Message<MessageOutBean>
. So far, so good.Now, in the first stage I want to conditionally make that Eventbus.request() and if I do not make it I want to send a "manufactured"
Message<MessageOutBean>
item to the subsequent stage. eg:So, my Java newbie question is:
io.vertx.mutiny.core.eventbus.Message
is an interface. How can I create an instance as per the else clause above? Do I need to make a class that implements Message? Or?Thanks,
Murray
Beta Was this translation helpful? Give feedback.
All reactions