ssdc-rm-pubsub-adapter

An adapter service to translate inbound PubSub messages into the standard format of RM JSON events and republish them on to our events exchange.
Prerequisites
Requires golang >= 1.13 installed
Configuration
The required environment configuration variables are:
RABBIT_HOST
RABBIT_PORT
RABBIT_USERNAME
RABBIT_PASSWORD
EQ_RECEIPT_PROJECT
QUARANTINE_MESSAGE_URL
Config to run locally against docker-compose dependencies
LOG_LEVEL=DEBUG
RABBIT_HOST=localhost
RABBIT_PORT=7672
RABBIT_USERNAME=guest
RABBIT_PASSWORD=guest
EQ_RECEIPT_PROJECT=project
PUBSUB_EMULATOR_HOST=localhost:8538
EQ_RECEIPT_PROJECT=project
QUARANTINE_MESSAGE_URL=http://httpbin.org/post
RABBIT_EXCHANGE=
NB: RABBIT_EXCHANGE is intentionally an empty string to use the rabbit default exchange
Config to run locally against docker dev
LOG_LEVEL=INFO
RABBIT_HOST=localhost
RABBIT_PORT=6672
RABBIT_USERNAME=guest
RABBIT_PASSWORD=guest
EQ_RECEIPT_PROJECT=project
PUBSUB_EMULATOR_HOST=localhost:8538
EQ_RECEIPT_PROJECT=project
QUARANTINE_MESSAGE_URL=http://localhost:8666/storeskippedmessage
Running the tests
Run
make build-test
This will run the formatter, build and units tests then spin up the dependencies with docker-compose and run the service integration tests.
Debugging the tests
To run the integration tests in an IDE
- Run
make up-dependencies to start up the dependencies with docker-compose.
- Set the environment variable
PUBSUB_EMULATOR_HOST=localhost:8538 in your IDE run configuration
- Run the test in debug mode
Run make format to automatically format the project using gofmt
Build the docker image
With
make docker
Run in docker-compose
Start the service and dependencies
Run make up to start the pubsub-adapter and dependencies through docker-compose
You can then run make logs to tail the logs
Post in a test message
You can send a test message onto the pubsub emulator with the tools script
PUBSUB_EMULATOR_HOST=localhost:8538 go run tools/publish_message.go
You should see the pubsub adapter log that it has processed the message and see the rabbit messages it produced in the rabbit management UI at http://localhost:17672 (login: guest, guest).