Giter Club home page Giter Club logo

alphagov.pay-ledger's Introduction

pay-ledger

This is a bare bones Dropwizard App for the Pay Ledger microservice.

Environment variables

There are several environment variables used for the app configuration. They're grouped in categories: database, SQS and background processing.

Variable Default Purpose
PORT - Port on which application listens

Database configuration

Variable Default Purpose
DB_USER - Name of the user used to connect to the database
DB_PASSWORD - Password of the user used to connect to the database
DB_HOST - Database host name
DB_NAME ledger Name of the database
DB_SSL_OPTION - Indicates whether the connection to the database should be secured with SSL (eg. ssl=true)

SQS configuration

Variable Default Purpose
AWS_SQS_REGION - SQS region
AWS_SQS_PAYMENT_EVENT_QUEUE_URL - SQS payment event queue URL
AWS_SQS_MESSAGE_MAXIMUM_WAIT_TIME_IN_SECONDS 20 Maximum wait time for long poll message requests to queue
AWS_SQS_MESSAGE_MAXIMUM_BATCH_SIZE 10 Maximum number of messages that should be received in an individual message batch
AWS_SQS_NON_STANDARD_SERVICE_ENDPOINT false Set to true to use a non standard (eg: http://my-own-sqs-endpoint) SQS endpoint
AWS_SQS_ENDPOINT - URL that is the entry point for SQS. Only required when AWS_SQS_NON_STANDARD_SERVICE_ENDPOINT is true
AWS_SECRET_KEY - Secret key. Only required when AWS_SQS_NON_STANDARD_SERVICE_ENDPOINT is true
AWS_ACCESS_KEY - Access key. Only required when AWS_SQS_NON_STANDARD_SERVICE_ENDPOINT is true

Background processing configuration

The background receiver will process all events that have been published to the SQS queue (AWS_SQS_PAYMENT_EVENT_QUEUE_URL).

A background thread managed by Dropwizard runs on all connector nodes. It polls the SQS payment event queue to retrieve the list of events. Processing each event involves adding a record to Event database table (unless the event is a duplicate of an event already processed, then the event is ignored).

If processing event fails it will be retried again after a specified delay (QUEUE_MESSAGE_RETRY_DELAY_IN_SECONDS). It is achieved by setting up the visibility timeout with the delay value which prevents consumers from receiving the message. After this timeout the message becomes visible for consumers again. More information of how the visibility timeout works can be found here.

The following variables control the background process:

Variable Default Purpose
QUEUE_MESSAGE_RECEIVER_THREAD_DELAY_IN_MILLISECONDS 1 Duration in seconds that the queue message receiver should wait between running threads
QUEUE_MESSAGE_RECEIVER_NUMBER_OF_THREADS 1 The number of polling threads started by the queue message scheduler
QUEUE_MESSAGE_RETRY_DELAY_IN_SECONDS 900 The duration in seconds that a message should be deferred before it should be retried

Licence

MIT License

Responsible Disclosure

GOV.UK Pay aims to stay secure for everyone. If you are a security researcher and have discovered a security vulnerability in this code, we appreciate your help in disclosing it to us in a responsible manner. We will give appropriate credit to those reporting confirmed issues. Please e-mail [email protected] with details of any issue you find, we aim to reply quickly.

alphagov.pay-ledger's People

Contributors

adityapahuja avatar alexbishop1 avatar danworth avatar dependabot-preview[bot] avatar heathd avatar jankowiakmaria avatar kbottla avatar nimalank7 avatar oswaldquek avatar rhowe-gds avatar richardtowers avatar rjbaker avatar sandorarpa avatar sfount avatar stephencdaly 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.