Search code examples
message-queuequarkusvert.xvertx-eventbus

Vert.x EventBus to communicate between two different application in Quarkus?


Can we use Vert.x EventBus to publish message to one application and from another independent application to consume it

I've tested publishing to EventBus and consuming in one application, where it works flawlessly, but when I tried to publish messages to EventBus and have another application consume them, it didn't work.


Solution

  • To use the Vert.x event bus in a distributed manner, you need:

    1. to put a Vert.x cluster manager on your classpath (I would recommend the Hazelcast one to start) - See https://vertx.io/docs/vertx-hazelcast/java/
    2. Enable the clustered mode of Vert.x using: quarkus.vertx.cluster.clustered=true (in your application.properties file)

    Instead of the second step, you can use https://quarkus.io/guides/vertx-reference#customizing-the-vert-x-configuration to customize the Vert.x configuration.

    Note that the clustered event bus is not supported in native mode.