Skip to content

Notification Service Design

Eric Jahn edited this page Feb 4, 2016 · 1 revision

Notification Builder

Notification builder receives necessary notification detail from the Client / Consumer. Relevant information for notification is Recipients / Sender / Notification Data

Notification Parameters

Notification parameters is set of key value pairs that can be read by Notification builder . These key /value pairs can be configured based on Report Type. For instance , Templates, Sender Email address, Sender Friendly name etc.

Worker Header (DB Entity)

Worker Header is a master table where we set up different Tasks that we have in the system. For Instance, Notification is a Task, Report Creation is task.

Worker Detail (DB Entity)

Worker Detail a child entity for worker Header. This is transaction table, and all the tasks for a given Worker Headers will be saved in this entity. For Instance, the notification Builder, once receives a request for a notification from a client, it makes an entry in Worker Detail with its associated Worker header Id.

Likewise, for a request for a Report, we will have an entry in the Worker Detail entity, with its associated Worker Header Id.

Notification Worker

Notification Worker is a scheduler job , invoked by spring container, at a pre-defined pace and polls Worker Detail for pending tasks. A report worker will poll for Report tasks and a Notification worker will poll for Notification tasks.

The job of this worker is to pick up the UNPROCESSED TASKS (check for the STATUS Column value 'INIT') and for each Notification task, it will make one entry in the Notification Header entity and multiple entries (as many as the number of recipients) in Notification Line entity.

The purpose of making an entry in Notification Line for each entity is to process each recipient notification differently , just because of the fact that the preferences could be different for each user. For instance, one recipient might have SMS notification preference where as other recipient might have a EMAIL notification preference.

Notification Work

A value object contains Notification data, recipient and sender information.

Notification Engine

This is a spring component that has both Carrier and Template components. The responsibility of the engine is to invoke Notification thread that handles invocations to Template service and then Carrier service.

Notification Thread

A process that handles invocation of template service and then carrier service (through Carrier Factory) for each notification.

Template Service

A business component that uses velocity template engine to merge the notification data with notification Template. Template Header will have an entry for each Template (for instance, AHAR_REPORT_TEMPLATE or BED_UTILIZATION_REPORT_TEMPLATE), and Template Line will have the location of of the template, with a version. In the future, if the template needs to be altered, we will make a new entry with the higher version. This is to keep track of different templates that we use and also to be able to use multiple templates.

Carrier Factory

Hands out relevant Carrier for sending out notification

Carrier Service

A business component that sends out the notification to the recipient. All the carriers use a spring configuration (carrier-config.xml) for the properties (like SMTP port, SMTP host)

Notification Service with MQ

The design below explains how Notifications are handled using MQ, instead of a scheduler. In the future, as we see the need for processing notification using MQ , we can send the notification requests from the consumer to MQ and then process each notification using notification message consumers (All the functionality that is built into Notification worker will be handled by MQ consumer).

Clone this wiki locally
You can’t perform that action at this time.