Publisher
Service performs http requests to registered service in case of event published Usually service starts at http://localhost:8080.
The next endpoints are available:
- Listener registration
POST /listener Body: {"event": "event_name1", "name": "listener_name_1", "address": "http://listener.address/handle"} - Listener unregister
DELETE /listener/listener_name_1 - Publish event
POST /publish/{event} Body: json
Run tests
$ make testor run
go test ./...
Run server locally
$ make runIt executes go run cmd/main.go under the hood. Which is the entry point for the api.
Control + C if you want to drop server
Build & Run docker image
$ make docker-build-runIt executes: docker image build -t publisher:latest . && docker container run -d -p 8080:8080 --name publisher publisher under the hood
or you can use the next commands one by one
$ make docker-buildand
$ make docker-runIf you want to stop and remove image then use next command
$ make docker-stopIt executes: docker stop publisher && docker rm publisher under the hood