Bulk Notifications
The Bulker sends the following notifications:
-
BulkArchivedNotification -
BulkClosedNotification -
BulkCompletedNotification -
BulkConfiguredNotification -
BulkFinalisedNotification -
BulkRejectedNotification -
BulkTerminatedNotification -
ChildBulkRegisteredNotification
These notifications are sent when the bulk is in the relevant state.
There are three options for handling Bulk Notifications:
-
Embedded Bulk Notification Handling
-
Send Bulk Notifications to an external system using Connectors
-
Send Bulk Notifications using in built support for sending notifications to Kafka
Embedded Bulk Notification Handling
Add the following dependency:
<dependency>
<groupId>com.iconsolutions.ipf.bulk</groupId>
<artifactId>ipf-bulker-notifications-api</artifactId>
</dependency>
And then provide an implementation of BulkNotificationPort, adding it as a bean to the Application Context.
Sending Bulk Notifications via Connectors
To send notifications to an external system, add the following dependency, which includes a Connector for sending Bulker Notifications.
<dependency>
<groupId>com.iconsolutions.ipf.bulk</groupId>
<artifactId>ipf-bulker-notifications-connector-core</artifactId>
</dependency>
Then define a specific ConnectorTransport<BulkNotification<?>> bean in the application context (supported ConnectorTransports include Kafka, HTTP and JMS). Please see Writing HTTP Connector for an example of configuring a HTTPConnectorTransport and wiring the ConnectorTransport into the Connector.
Sending Bulk Notifications to Kafka
To send notifications to a Kafka topic, instead of including the above dependency, include the dependency below. Using the dependency below means support for sending notifications via Kafka is preconfigured.
<dependency>
<groupId>com.iconsolutions.ipf.bulk</groupId>
<artifactId>ipf-bulker-notifications-connector-kafka</artifactId>
</dependency>
Notification Retries
The Bulker provides automatic retry of failed notifications, ensuring at-least-once delivery even in the presence of transient failures (e.g. downstream system unavailability, network issues).
How It Works
When a bulk transitions to a state that requires a notification, a notification intent is persisted to the notificationIntent collection. Once the notification is successfully sent, the intent is marked as "sent". If sending fails, the intent remains "pending" and becomes eligible for retry.
A background process periodically polls for pending intents and retries them until they are successfully sent.
Idempotency
Because notifications are retried until successfully delivered, it is possible for a notification to be sent more than once (at-least-once delivery). Consumers of bulk notifications should be designed to be idempotent.
Configuration
| Config | Type | Description | Default |
|---|---|---|---|
|
Duration |
How frequently the Bulker checks for pending notification intents that need to be retried. |
|
|
Duration |
How long to wait before retrying a pending intent. This prevents retrying intents that are still being processed by the normal notification flow. |
|