-
Notifications
You must be signed in to change notification settings - Fork 2
DbServicePg
do- edited this page Jul 16, 2024
·
9 revisions
DbServicePg
is a JobSource that creates and launches jobs based on notifications incoming from a DbListenerPg.
A Job is produced, the raw Notification
is injected as its notification
field and toComplete () is launched.
const mailChannel = new DbServicePg(app, {
name: 'mail',
on: {
start: function () {
this.rq = {type: 'mail', 'action': 'send', id: this.notification.payload}
}
},
})
The signature here is just like the parent class. Only the name
option is added.
Tries to parse notification.payload
as JSON and returns true
if the result is an Object, false
for any other non empty string notification.payload
. Throws Error if the notification
is not processable at all.
If getQueue (notification)
returns a non-null
value (thus, a Queue instance), calls its check () method.
Creates a new Job instance, injects notification
, sets event handlers and launches the execution.