Microservice that exposes an API to manage information in Hazelcast Maps
69
Microservice that exposes an API to manage information in Hazelcast Maps
See CHANGELOG.md
| Property | Default value | Desciption |
|---|---|---|
| MICRONAUT_SERVER_PORT | 6969 | The port on the API is listening |
| MICRONAUT_SERVER_MAX_REQUEST_SIZE | 1024 | Max size, in bytes, allowed for an incoming request |
| HAZELCAST_NETWORK_ADDRESSES | localhost:5701 | The DNS and port of the Hazelcast cluster |
| HAZELCAST_CLIENT_NAME | hazelcastApi | The name representing this microservice the list of clients from Hazelcast connections |
| HAZELCAST_CLIENT_CLUSTERNAME | dev | The name of the Hazelcast cluster to connect |
| MICRONAUT_METRICS_ENABLED | true | Enable or disable the Micronaut metrics endpoint |
| Endpoint | Method | Produces | Consumes | Body | Desciption |
|---|---|---|---|---|---|
| /v1/map | PUT | application/json | application/json | {"key":"foo", "value":"myvalue", "map-name":"mymap"} | Write a key/value on a specific Hazelcast Map |
| /v1/map | POST | application/json | application/json | {"key":"foo", "map-name":"mymap"} | Get the value from a key on a specific Hazelcast Map |
curl -X PUT http://localhost:6969/v1/map --header "Content-Type: application/json" -d '{"key":"foo","value":"myvalue2", "map-name":"mymap2"}'
curl -X PUT http://localhost:6969/v1/map --header "Content-Type: application/json" -d '{"key":"foo","value":"{\"internal_key\": \"internal_value\"}", "map-name":"mymap2"}'
curl -X POST http://localhost:6969/v1/map --header "Content-Type: application/json" -d '{"key":"complexkey", "map-name": "mymap2"}'
docker run -it --rm --name my-hazelcast-api -p 6969:6969 marcosflobo/hazelcast-api:1.0.0
docker run -it --rm --name my-hazelcast-api -p 6969:6969 --env HAZELCAST_NETWORK_ADDRESSES=hazelcast:5701 --env HAZELCAST_CLIENT_NAME=hazelcast-api-docker --env HAZELCAST_CLIENT_CLUSTERNAME=dev --env MICRONAUT_SERVER_PORT=6969 marcosflobo/hazelcast-api:1.0.0
During development, it's very important test and test fast, not only the application but also how it will work when it's deployed in production. For that, it's important to test via Docker container and, for doing so, we can use a docker-compose file.
The docker-compose.yml file will run:
$ ./gradlew clean assemble && docker-compose up --build
http_server_requests_seconds_countTo stop the docker-compose, just type Ctrl+c. To remove the containers created, run docker-compose down.
| Endpoint | Desciption |
|---|---|
| /metrics | Metrics information in JSON format |
| /prometheus | Metrics information in Prometheus format |
| /health | Status health of the service in JSON format |
Content type
Image
Digest
Size
217.8 MB
Last updated
almost 6 years ago
docker pull marcosflobo/hazelcast-api:1.0.0