Giter Club home page Giter Club logo

hmcts.ia-timed-event-service's Introduction

ia-timed-event-service

Service to trigger CCD Events in the future

Background

There are Business needs to do actions in future with specified period of time like reminders, state change triggers etc. ia-timed-event-service allows to schedule submission for desired CCD Event with given date and time in future.

Testing application

Unit tests and code style checks:

./gradlew build

Integration tests use Wiremock and Spring MockMvc framework:

./gradlew integration

Functional tests use started application instance:

./gradlew functional

Running application

ia-timed-event-service is common Spring Boot application. Command to run:

./gradlew bootRun

There is special testing endpoint included in the code. It can be activated by changing Spring profile. Command to run:

SPRING_PROFILES_ACTIVE=test ./gradlew bootRun

Usage

Scheduling new CCD Event can be done by sending request with TimedEvent JSON body to /timed-event endpoint:

{
  "caseId": 0,
  "caseType": "Asylum",
  "event": "someEvent",
  "jurisdiction": "IA",
  "scheduledDateTime": "2020-05-29T14:21:08.758Z"
}

event - desired CCD Event to being submitted in future

scheduledDateTime - exact date and time when CCD Event should be submitted

Response contains created TimedEvent object with id field for reference and response status 201 CREATED.

GET endpoint /timed-event/{id} allows to check if TimedEvent is scheduled in future. The endpoint returns only events scheduled in future. If the event has already been submitted, response code returns as 404 NotFound.

Sending another POST request for already created TimedEvent with valid id field, re-schedules it in the system.

API details about usages and error statuses are placed in Swagger UI

Implementation

Scheduling is based on Quartz Framework and Spring Boot integration. Persistence storage is Postgres database.

Quartz Documentation

Event submission is done by dedicated system user with caseworker-ia-system role. Make sure your CCD definitions are in place before Event submission is done.

ia-timed-event-service has finite retry policy and it tries configurable number of times to submit given CCD Event.

Authentication is defined as any other Reform application with Idam Authorization token and S2S ServiceAuthorization token.

Every Business logic and validation have to be implemented in scheduled CCD Event. ia-timed-event-serivce is not responsible for checking case state data.

For example: Scheduled Event may become not needed anymore after manual user action is taken.

In this case downstream application (ia-case-api) must implement robust logic to prevent unsuspected behaviour and handle future CCD Event submission gracefully.

hmcts.ia-timed-event-service's People

Contributors

makowalski avatar burale avatar divisathyan avatar raghera 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.