Giter Club home page Giter Club logo

hmrc.file-transmission-callback-listener's Introduction

file-transmission-callback-listener

Overview

This is a helper service for testing and integration with the HMRC file transmission service file-transmission.

The file-transmission service uses asynchronous HTTP callbacks to notify it's clients (consuming services ) about the outcome of file transmission operations. In order to be able to perform acceptance tests of file-transmission we need to mock of the consuming service ability to consume callbacks. By running this service locally, you can provide a callback URL for a locally running file-transmission.

This service will also run in the pre-production environments (Development, QA, Staging).

Using the service

POST to the service

The service has a POST endpoint, which when hit will write to application logs.

POST request: URL: http://localhost:12345/file-transmission-callback-listener/listen

Request body:

{
    "reference": "my-reference",
    "downloadUrl": "http://my.download.url"
}

Response body:

{
    "reference": "my-reference",
    "downloadUrl": "http://my.download.url"
    "hash": "e7e5955a9926ff43412fcb4ff4e65e68"
}

Once the file has been successfully transferred to the S3 bucket for download, a POST will be made by upscan-notify to upscan-listener, and this event will be written to the logs.

If the end-to-end process has worked as expected, you should see the following in the upscan-listener application logs:

Callback has been received with file-reference: [file-reference]

GET list of recent callbacks

The service has a GET endpoint, which can be used to query the successful callbacks that the service has made since 00:00 on the day queried. These calls are stored in local memory, meaning that when the app is restarted, the log will be lost. It will ONLY log successful calls, not any instances where there has been an error with the callback.

GET request: URL: http://localhost:12345/file-transmission-callback-listener/poll/{fileReference}

Response body:

{
    "currentDate": "2018-03-19",
    "callbacks": [
         {
              "file-reference":"11370e18-6e24-453e-b45a-76d3e32ea33d",
              "batch-id":"32230e18-6e24-453e-b45a-76d3e32ea33d",
              "outcome":"SUCCESS"
         },
    {
          "fileReference":"11370e18-6e24-453e-b45a-76d3e32ea33d",
          "batchId":"32230e18-6e24-453e-b45a-76d3e32ea33d",
          "outcome":"FAILURE"
          "errorDetail":"text field from MDG"
       }
    ],
}

GET the list of callbacks for specific file id

GET request: URL: http://localhost:12345/file-transmission-callback-listener/poll

Response body:

{
    "currentDate": "2018-03-19",
    "callbacks": [
         {
              "file-reference":"11370e18-6e24-453e-b45a-76d3e32ea33d",
              "batch-id":"32230e18-6e24-453e-b45a-76d3e32ea33d",
              "outcome":"SUCCESS"
         },
    {
          "fileReference":"11370e18-6e24-453e-b45a-76d3e32ea33d",
          "batchId":"32230e18-6e24-453e-b45a-76d3e32ea33d",
          "outcome":"FAILURE"
          "errorDetail":"text field from MDG"
       }
    ],
}

Running locally

Start your file-transmission-callback-listener service on port 12345 with the following command: sbt "run 12345"

To use the service, use the following URL for callback in your service: http://localhost:12345/listen

Using in the environments

You can use the file-transmission-callback-listener URLs in the pre-production environments, and check in the Kibana logs to see that your file has been successfully uploaded to AWS, and the callback URL hit.

Use the following URLs for callback when sending details to file-transmission:

Development: https://file-transmission-callback-listener.public.mdtp/file-transmission-callback-listener/listen

QA: https://file-transmission-callback-listener/.public.mdtp/file-transmission-callback-listener//listen

Staging: https:/file-transmission-callback-listener.public.mdtp/file-transmission-callback-listener/listen

Links to the Kibana logs are available from the catalogue

hmrc.file-transmission-callback-listener's People

Contributors

cjwebb avatar cybersaurus avatar dabd avatar hmrc-web-operations avatar jamesluahmrc avatar jopintopaul avatar swathimadhuri avatar tomasz-rosiek 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.