fix: publish system.notification.send in {pattern, data} format for NestJS RMQ
This commit is contained in:
parent
8209f4ac82
commit
fb0bb36bdd
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@erp/plugin-sdk",
|
||||
"version": "1.11.1",
|
||||
"version": "1.11.2",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"bin": {
|
||||
|
|
|
|||
|
|
@ -410,10 +410,9 @@ export class CoreService {
|
|||
const conn = await amqp.connect(this.getRMQUrl());
|
||||
const ch = await conn.createChannel();
|
||||
await ch.assertExchange('system_events', 'topic', { durable: true });
|
||||
const eventData = {
|
||||
eventId: uuidv4(),
|
||||
ch.publish('system_events', 'system.notification.send', Buffer.from(JSON.stringify({
|
||||
pattern: 'system.notification.send',
|
||||
payload: {
|
||||
data: {
|
||||
userId: payload.userId,
|
||||
title: payload.title,
|
||||
message: payload.message,
|
||||
|
|
@ -421,10 +420,7 @@ export class CoreService {
|
|||
image: payload.image,
|
||||
details: payload.details,
|
||||
},
|
||||
source: this.serviceName,
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
ch.publish('system_events', 'system.notification.send', Buffer.from(JSON.stringify(eventData)));
|
||||
})));
|
||||
await ch.close();
|
||||
await conn.close();
|
||||
} catch (err: any) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue