Skip to content

Kafka consumer that hooks into the document-generator process asynchronously

License

Notifications You must be signed in to change notification settings

companieshouse/document-generator-consumer

Repository files navigation

document-generator-consumer

Kafka consumer that hooks into the document-generator process asynchronously

Requirements

In order to build document-generator locally you will need the following:

Getting started

  1. Run make
  2. Run ./start.sh

Environment Variables

The supported environmental variables have been categorised by use case and are as follows.

Deployment Variables

Name Description Mandatory Default Example
DOCUMENT_GENERATION_CONSUMER_SERVICE_PORT Configured port application runs on. 10097
CONSUMER_TOPIC Topic for the consumer to pick up render-submitted-data-document
GROUP_NAME Group name for the consumer document-generator
CHS_API_KEY Chs api key encoded and used to make APi calls valid Api key

Kafka

Consumer

A consumer group will poll the render-submitted-data-document topic for requests to generate a document.

Docker

To build a Docker image run the following command:

mvn compile jib:dockerBuild

This will output a Docker imaged named: 169942020521.dkr.ecr.eu-west-1.amazonaws.com/local/document-generator-consumer

You can specify a different image name run mvn compile jib:dockerBuild -Dimage=<YOUR NAME HERE>

Producer

The following topics are produced to during the generation process:

Name Description
document-generation-started Notification that the generation of the document has started
document-generation-completed Details of the generated document
document-generation-failed Notification that the generation of the document has failed

Terraform ECS

What does this code do?

The code present in this repository is used to define and deploy a dockerised container in AWS ECS. This is done by calling a module from terraform-modules. Application specific attributes are injected and the service is then deployed using Terraform via the CICD platform 'Concourse'.

Application specific attributes Value Description
ECS Cluster document-generation ECS cluster (stack) the service belongs to
Load balancer N/A consumer service The load balancer that sits in front of the service
Concourse pipeline Pipeline link
Pipeline code
Concourse pipeline link in shared services

Contributing

Testing

  • Ensure the terraform runner local plan executes without issues. For information on terraform runners please see the Terraform Runner Quickstart guide.
  • If you encounter any issues or have questions, reach out to the team on the #platform slack channel.

Vault Configuration Updates

  • Any secrets required for this service will be stored in Vault. For any updates to the Vault configuration, please consult with the #platform team and submit a workflow request.

Useful Links