This repository has been archived by the owner on Nov 21, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(dependencies): made rabbitmq, redis optional
- Loading branch information
Showing
53 changed files
with
1,525 additions
and
879 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import * as dotenv from 'dotenv'; | ||
import messageBroker from 'erxes-message-broker'; | ||
import { debugBase } from './debuggers'; | ||
import { Logs } from './models'; | ||
import { sendSms, start } from './sender'; | ||
|
||
dotenv.config(); | ||
|
||
let client; | ||
|
||
export const initBroker = async () => { | ||
client = await messageBroker({ name: 'logger', RABBITMQ_HOST: process.env.RABBITMQ_HOST }); | ||
|
||
const { consumeQueue } = client; | ||
|
||
// listen for rpc queue ========= | ||
consumeQueue('erxes-api:engages-notification', async ({ action, data }) => { | ||
debugBase(`Receiving queue data from erxes-api`, data); | ||
|
||
if (action === 'sendEngage') { | ||
await start(data); | ||
} | ||
|
||
if (action === 'writeLog') { | ||
await Logs.createLog(data.engageMessageId, 'regular', data.msg); | ||
} | ||
|
||
if (action === 'sendEngageSms') { | ||
await sendSms(data); | ||
} | ||
}); | ||
}; | ||
|
||
export default function() { | ||
return client; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.