Skip to content

Commit

Permalink
PI-2187 Add tech docs for domain events and Delius (#4561)
Browse files Browse the repository at this point in the history
* PI-2187 Add tech docs for domain events and Delius

* PI-2187 Fix the paths to the generated images in the tech docs
  • Loading branch information
jsimonsmoj authored Jan 22, 2025
1 parent f9d6fe6 commit 7f45d38
Show file tree
Hide file tree
Showing 5 changed files with 1,069 additions and 2 deletions.
31 changes: 29 additions & 2 deletions projects/domain-events-and-delius/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
# domain-events-and-delius
# Domain events and Delius
This domain event service enables enhancement of domain events from Delius. The domain events are retrieved from the database in batches, enhanced and published to SNS.

// TODO Describe the service
The supported domain event enhancers are:

| Message event type | Description |
| --------------------------------- | --------------------------------------------- |
| probation-case.engagement.created | Adds a detail URL to retrieve engagement data |

# Data dependencies
Domain event service depends on Delius for retrieving batches of domain events waiting to be processed. Each domain event will contain a unique ID, message body and message attributes. The message body will contain the event type.

## Context map - Domain Event Data

![](./tech-docs/source/img/domain-events-context-map.svg)

# Workflows
## Enhancing a domain event
Domain events are retrieved from the database in batches. Each domain event will be processed in order. The domain event will contain an event type within the message body. The event type is mapped to an enhancement if one exists, otherwise it is matched to a no enhancement catch-all which will just publish the original domain event. Once a domain event has been enhanced it will be published to SNS.

![](./tech-docs/source/img/domain-events-enhancement-workflow.svg)

# API Access Control
API endpoints are available to retrieve additional information related to a domain event. These URLs will be added to the domain event message by enhancers within the domain event service.

The API endpoints are secured by roles supplied by the HMPPS Auth client used in the requests.

| API endpoint | Required role |
| --------------------------------------- | ------------------------------------------ |
| probation-case.engagement.created/{crn} | PROBATION_API_\_DOMAIN_EVENTS_\_ENGAGEMENT |
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

style { ...@../../../../script/style.style }
vars { ...@../../../../script/style.vars }
** { ...@../../../../script/style.all-style }

context-delius: Delius Context {

entities: Entities {
grid-columns: 2
person: Person on Probation
event: Domain event {
message: Message body
attributes: Message attributes
}
}
}

context-notification: Notification Context {

interface: Delius and\n Notification {
type: Anti-Corruption\nLayer
}

entities: Entities {
grid-columns: 2
notification: Notification {
message: Message
attributes: Attributes
}
}
}

context-delius--context-notification.interface: Upstream\n\n\nDownstream
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Domain Event Workflow: Domain Event Enhancement

direction: right

style { ...@../../../../script/style.style }
vars { ...@../../../../script/style.vars }
** { ...@../../../../script/style.all-style }

# Domain Event Enhancement
domain-event-enhancement: Domain Event Enhancement {
style.font-size: 24
grid-columns: 2

d_get_events: Get domain events batch
d_enhance_events: Enhance domain event
d_publish: Publish notification

d_get_events -> d_enhance_events -> d_publish

explanation: |md
## Enhance an event
- Get batch of domain events
- If event type is supported,\
enhance the event
- Transform the event to\
a notification
- Publish the notification
|

}
Loading

0 comments on commit 7f45d38

Please sign in to comment.