Skip to content

Mastercard-Gateway/vertx-workers-example

Repository files navigation

README

This project is a small example of Worker verticles running with Vert.x 3.5.4. It simulates a small coffee shop processing orders from customers. Customers send coffee orders to a HTTP endpoint, which are then sent to worker verticles which process the order for a random period of time, in effect behaving like blocking code.

Compiling

To compile the application, run the following with Java 8:

./mvnw package

Running

To run the application:

java -Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory -jar target/vertx-workers.jar

The Dvertx.logger-delegate-factory-class-name system variable ensures that SLF4j is used with logback so that logs contain more details, in particular regarding threads running.

The application runs by default on the port 8085.

To test the application, you can use the ruby script present at the root:

ruby process_coffees.rb

The script sends 2 batches of 3 random coffee orders to the HTTP http://localhost:8085/coffee endpoint.

License

Apache License, version 2.0.

© Copyright 2018,2021,2022 – Sébastien Le Callonnec

About

Example of Vert.x Worker verticles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published