This repo contains a bunch of several implementation on the same logic:
- Implements a HTTP endpoint waiting for a JSON looking like
{"id": 1, "data": "foo"}
as a POST body - Hash the
.data
field of the body using the Black2B hash function - Retrieve a client from postgres using the
.id
as the key - Build a JSON message with the client.name in the
name
field and the hash in thehash
field - Send this message on RabbitMQ
- Return this message in the HTTP response
For fun of course! Initially, the rust implementation was built for a presentation by @fistons but then he wanted to compare rust performance against other languages
Easy! Create a subdirectory in this repo, with your code and a Dockerfile and add it to the docker-compose. Here are the infos and credentials for the others services:
- RabbitMQ:
- host:
rabbitmq
- username:
guest
- password:
guest
- host:
- Postgreql:
- host:
postgres
- username:
rust
- password:
rust
- host:
Then, just add your service in the docker-compose.yml
file, binding a specific port to the host and let's roll!
The database migration and filling is taking care of in the docker compose.
Here is the CREATE TABLE
:
CREATE TABLE clients (
id serial primary key,
name varchar(100) not null unique
);
Please note that there is only one client loaded by the migration:
id | name |
---|---|
1 | Uber Client |
- Exchange name:
toRustDemo
- Routing key:
rust
- The reactive java implementation uses old fashion blocking jdbc because the postgres r2dbc driver is slow as hell