Notification Offline Requests
Summary
This worker subscribes to the notifications-notification-offline-requested Pub/Sub topic and publishes these notification requests to the notifications-notification-requested Pub/Sub topic
| Service Type | Worker |
| Pub/Sub Topic | notifications-notification-offline-requested |
| Pub/Sub Subscription | notifications-notification-offline-requested-notification-offline-requests-worker |
Testing
./scripts/start-with-monolith-db.sh
# rails c
data = {
"notification_name" => "unread_inbox_message_daily_digest",
"notification_version" => "1",
"user_id" => "125",
"created_at" => "2024-08-08T14:03:20.027551+00:00",
"attributes" => {
"unread_messages" => [{
"sender_id" => "1",
"sender_institution_id" => "1",
"internal_message_id" => "123",
}]
}
}.to_json
pubsub = Rails.configuration.pubsub
topic = pubsub.topic("notifications-notification-offline-requested")
topic.publish_async(data)
Pub/Sub Message Schema
This worker expects Pub/Sub messages to be JSON-formatted with the following schema:
| Field | Description | |
|---|---|---|
| Notification Name | Required | The name of the requested notification. This should match an existing notification config in the Notifications Service. If it does not, a Bugsnag will be raised and the message will not be retried. |
| Notification Version | Required | The version of the requested notification. This should match an existing notification config in the Notifications Service. If it does not, a Bugsnag will be raised and the message will not be retried. |
| User Id | Required | The monolith user id of the notification recipient. |
| Email Address | Optional | The email address of the notification recipient. If not provided, the primary email of the recipient will be used. |
| Attributes | Optional | Data required to build the requested notification. |
| Metadata | Optional | Data to be included for data analytics. |
| Created At | Required | Time at which the offline notification data was gathered. |
Example
{
"notification_name": "unread_inbox_message_daily_digest",
"notification_version": "1",
"user_id": "125",
"created_at": "2024-08-08T14:03:20.027551+00:00",
"attributes": {
"unread_messages": [
{
"internal_message_id": "123",
"sender_id": "1",
"sender_institution_id": "1"
}
]
}
}
Monitoring
TODO