@go-mailer/vertebra 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants/queues.js +2 -0
- package/lib/queue/rabbit.js +8 -4
- package/package.json +1 -1
package/lib/constants/queues.js
CHANGED
|
@@ -15,11 +15,13 @@ module.exports = {
|
|
|
15
15
|
EMAIL_SENT: "successful_emails_sent",
|
|
16
16
|
EMAIL_FAILED: "failed_email_sends",
|
|
17
17
|
CAMPAIGN_PROCESSED: "campaign_processed",
|
|
18
|
+
CAMPAIGNS_TO_PROCESS: "campaigns_to_process",
|
|
18
19
|
TRANSACTIONAL_SENT: "transactional_sent",
|
|
19
20
|
|
|
20
21
|
NOTIFICATION: "new_notification",
|
|
21
22
|
|
|
22
23
|
EMPTY_WALLET: "insufficient_wallet_balance",
|
|
24
|
+
WALLET_CHARGES: "charge_wallet",
|
|
23
25
|
REFUND: "refunds",
|
|
24
26
|
WALLET_TOPUP: "wallet_topup",
|
|
25
27
|
};
|
package/lib/queue/rabbit.js
CHANGED
|
@@ -4,12 +4,16 @@ const Broker = async ({
|
|
|
4
4
|
host = 'localhost',
|
|
5
5
|
user = 'guest',
|
|
6
6
|
passwd = 'guest',
|
|
7
|
-
port = 5672
|
|
7
|
+
port = 5672
|
|
8
8
|
}) => {
|
|
9
9
|
const url = `amqp://${user}:${passwd}@${host}:${port}`
|
|
10
10
|
const conn = await rabbit.connect(url)
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
let channel = await conn.createChannel()
|
|
12
|
+
|
|
13
|
+
conn.on('error', async (error) => {
|
|
14
|
+
channel = await conn.createChannel()
|
|
15
|
+
})
|
|
16
|
+
|
|
13
17
|
const acknowledge = (message = null) => {
|
|
14
18
|
if (message) channel.ack(message)
|
|
15
19
|
else channel.ackAll()
|
|
@@ -34,4 +38,4 @@ const Broker = async ({
|
|
|
34
38
|
return { acknowledge, publish, recover, subscribe }
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
module.exports = Broker
|
|
41
|
+
module.exports = Broker
|