Giter Club home page Giter Club logo

onsdigital.census-rm-pubsub-adapter's Introduction

census-rm-pubsub-adapter

Build Status Go Report Card

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
OFFLINE_RECEIPT_PROJECT
QM_UNDELIVERED_SUBSCRIPTION_PROJECT
PPO_UNDELIVERED_SUBSCRIPTION_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:8539
EQ_RECEIPT_PROJECT=project
OFFLINE_RECEIPT_PROJECT=offline-project
QM_UNDELIVERED_SUBSCRIPTION_PROJECT=qm-undelivered-project
PPO_UNDELIVERED_SUBSCRIPTION_PROJECT=ppo-undelivered-project
RECEIPT_ROUTING_KEY=goTestReceiptQueue
UNDELIVERED_ROUTING_KEY=goTestUndeliveredQueue
FULFILMENT_CONFIRMED_PROJECT=fulfilment-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
OFFLINE_RECEIPT_PROJECT=offline-project
QM_UNDELIVERED_SUBSCRIPTION_PROJECT=qm-undelivered-project
PPO_UNDELIVERED_SUBSCRIPTION_PROJECT=ppo-undelivered-project
FULFILMENT_CONFIRMED_PROJECT=fulfilment-confirmed-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

  1. Run make up-dependencies to start up the dependencies with docker-compose.
  2. Set the environment variable PUBSUB_EMULATOR_HOST=localhost:8539 in your IDE run configuration
  3. Run the test in debug mode

Formatting

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:8539 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).

onsdigital.census-rm-pubsub-adapter's People

Contributors

adamhawtin avatar apolloakora avatar davidmort avatar nickgrantx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.