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",
|
"name": "@erp/plugin-sdk",
|
||||||
"version": "1.11.1",
|
"version": "1.11.2",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
||||||
|
|
@ -410,10 +410,9 @@ export class CoreService {
|
||||||
const conn = await amqp.connect(this.getRMQUrl());
|
const conn = await amqp.connect(this.getRMQUrl());
|
||||||
const ch = await conn.createChannel();
|
const ch = await conn.createChannel();
|
||||||
await ch.assertExchange('system_events', 'topic', { durable: true });
|
await ch.assertExchange('system_events', 'topic', { durable: true });
|
||||||
const eventData = {
|
ch.publish('system_events', 'system.notification.send', Buffer.from(JSON.stringify({
|
||||||
eventId: uuidv4(),
|
|
||||||
pattern: 'system.notification.send',
|
pattern: 'system.notification.send',
|
||||||
payload: {
|
data: {
|
||||||
userId: payload.userId,
|
userId: payload.userId,
|
||||||
title: payload.title,
|
title: payload.title,
|
||||||
message: payload.message,
|
message: payload.message,
|
||||||
|
|
@ -421,10 +420,7 @@ export class CoreService {
|
||||||
image: payload.image,
|
image: payload.image,
|
||||||
details: payload.details,
|
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 ch.close();
|
||||||
await conn.close();
|
await conn.close();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue