-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eventBus publisher should have a publish method #1468
Comments
@seanjburns Hi, I hope I got what you need DeliveryOptions options = new DeliveryOptions();
options.addHeader("action", "findAll");
MessageProducer<JsonObject> publisherMessage = eventBus.<JsonObject>publisher("io.vertx.news", options);
MessageProducer<JsonObject> senderMessage = eventBus.<JsonObject>sender("io.vertx.news", options);
JsonObject message = new JsonObject();
publisherMessage.<JsonObject>send(message, reply -> {
// publish
});
senderMessage.<JsonObject>send(message, reply -> {
// send
}); |
^^ You see, I'm not the only one easily "fooled" @EmadAlblueshi just pasted a "solution" thats does not "publish" as expected. @EmadAlblueshi this function Does not actually "publish" to all consumers, it "sends" to a single consumer. You actually have to use the write method like this
FYI this is just a usability issue that is all. |
@seanjburns you are absolutely correct. I have just discovered that "write" method will do the publishing instead of sending. From usability perspective I think it should be "publish" to vanish such a confusion +1 |
I think having a |
Maybe for vertx 4.0 (3.4?), We can have 2 interfaces that extend MessageProducer. Then the publisher and sender methods can return the respective interfaces. |
@seanjburns I was rather thinking deprecating the |
If you don't want to provide the address all the time, just create a publisher with an address:
I think |
It was slightly confusing when i used the eventBus to create publisher.
I had code that looked like this
vertx.eventBus().publish("endpoint","Hello World");
and wanted to use a publisher instead
vertx.eventBus().publisher("endpoint")
but the publisher did not have the "publish" method (the write method does the correct function though).
The text was updated successfully, but these errors were encountered: