Skip to content

Latest commit

 

History

History

eventbus

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

EventBus

This is a simple sample that illustrates how to use Vert.x EventBus with reply:

  • eventbus-receiver listens to messages. Depending on the address, it can reply with a timeout for a while or a failure before replying with a sucess message.

  • eventbus-sender starts verticles that sends a "Hello" message. If the reply is timeout or has a failure, attempts to retry to send the message several times

There is a version with Handler and with RxJava. The sample uses a Vert.x cluster of the above described verticles.

 Run the examples with maven

mvn clean install
cd eventbus-receiver
mvn clean vertx:run -Dvertx.runArgs="-cluster" -Dvertx.jvmArguments="-Djava.util.logging.config.file=logging.properties"

Open another terminal:

cd eventbus-sender
mvn clean vertx:run -Dvertx.runArgs="-cluster" -Dvertx.jvmArguments="-Djava.util.logging.config.file=logging.properties"

Run the examples with an IDE

eventbus-receiver

Create a Run configuration for the project eventbus-receiver with the following configuration:

  • Main class: io.vertx.core.Launcher

  • VM options: -Djava.util.logging.config.file=src/main/resources/logging.properties

  • Program arguments: run org.ws13.howtos.vertx.eventbus.receiver.DeployVerticle -cluster

  • Use of classpath module: eventbus-receiver

The VM option switch off the verbosity of the Cluster library Ignite

eventbus-sender

Create a Run configuration for the project eventbus-sender with the following configuration:

  • Main class: io.vertx.core.Launcher

  • VM options: -Djava.util.logging.config.file=src/main/resources/logging.properties

  • Program arguments: run org.ws13.howtos.vertx.eventbus.sender.DeployVerticle -cluster

  • Use of classpath module: eventbus-sender

The VM option switch off the verbosity of the Cluster library Ignite

Run the eventbus-receiver first since it listens to messages sent by the eventbus-sender at startup.