Skip to content

ministryofjustice/hmpps-prison-offender-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

573 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

prison offender events

Ministry of Justice Repository Compliance Badge Docker Repository on ghcr API docs Event docs Publishes Events about prison offender changes to Pub / Sub Topics

Running localstack

TMPDIR=/private$TMPDIR docker compose up localstack

Creating the Topic and Queue

Simplest way is running the following script

./setup-sns.bash

Or you can run the scripts individually as shown below.

Creating a topic and queue on localstack

aws --endpoint-url=http://localhost:4566 sns create-topic --name offender_events

Results in:

{
    "TopicArn": "arn:aws:sns:eu-west-2:000000000000:offender_events"
}

Creating a queue

aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name event_queue

Results in:

{
   "QueueUrl": "http://localhost:4566/queue/event_queue"
}

Creating a subscription

aws --endpoint-url=http://localhost:4566 sns subscribe \
    --topic-arn arn:aws:sns:eu-west-2:000000000000:offender_events \
    --protocol sqs \
    --notification-endpoint http://localhost:4566/queue/event_queue \
    --attributes '{"FilterPolicy":"{\"eventType\":[\"EXTERNAL_MOVEMENT_RECORD-INSERTED\", \"BOOKING_NUMBER-CHANGED\"]}"}'

Results in:

{
    "SubscriptionArn": "arn:aws:sns:eu-west-2:000000000000:offender_events:074545bd-393c-4a43-ad62-95b1809534f0"
}

Read off the queue

aws --endpoint-url=http://localhost:4566 sqs receive-message --queue-url http://localhost:4566/queue/event_queue

Running tests

The integration tests depend on localstack to be running to access the topics and test queues, this can be started with docker-compose

docker compose -f docker-compose-test.yml up

Smoke Tests

The source set testSmoke contains the smoke tests.

These tests are not intended to be run locally, but instead are run against a deployed application (as happens in the Github actions build).

For more information on the smoke tests see the project dps-smoketest.

About

Publishes Events about offender change to Pub / Sub Topics

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors