https://github.com/ananto30/vertx-async-gateway
Async to sync using Vert.x event bus
https://github.com/ananto30/vertx-async-gateway
docker eventbus java vertx vertx-web
Last synced: 12 months ago
JSON representation
Async to sync using Vert.x event bus
- Host: GitHub
- URL: https://github.com/ananto30/vertx-async-gateway
- Owner: Ananto30
- Created: 2021-01-20T09:52:14.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-22T07:18:11.000Z (almost 5 years ago)
- Last Synced: 2024-05-21T06:06:39.068Z (almost 2 years ago)
- Topics: docker, eventbus, java, vertx, vertx-web
- Language: Java
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vertx Async to Sync
[](https://lgtm.com/projects/g/Ananto30/vertx-async-gateway/context:java)
Example of converting (legacy) async service to sync.
## Run for dev
Directly run the DevApp. All the tweaks can be done with the code.
## Run for production/testing
Can be run using the fat jar.
Create jar:
```
./mvnw clean package
```
Or skip tests:
```
./mvnw clean package -Dmaven.test.skip=true
```
____________________
Run with java:
```
java -jar target/starter-1.0.0-SNAPSHOT-fat.jar -cluster -cluster-public-port 17001 -cluster-public-host -instance 4
```
**Important notes:**
The `-cluster` ensures verticles are running in cluster mode, so the event bus can communicate with all the verticles even if they are running in different machines.
`-cluster-public-port` is the public exposing port where the other clusters can connect to.
`-cluster-public-host` is **really important**. You should expose the IP of your machines so that other clusters can connect to it.
`-instance` is how many instances you want to run. Can be your core numbers, but better play with it. Especially each instance has a single eventloop.
## Test with Docker
Create jar:
```
./mvnw clean package
```
Or skip tests:
```
./mvnw clean package -Dmaven.test.skip=true
```
____________________
Docker build:
```
docker build -t vertx-async-gateway .
```
Docker run two instances exposed with different ports:
```
docker run -p 8888:8888 -e cluster-public-host= -d vertx-async-gateway
docker run -p 8889:8888 -e cluster-public-host= -d vertx-async-gateway
```
**To test properly use something like nginx to load balance among 8888 and 8889**