|
@@ -12,6 +12,25 @@ class RabbitmqService extends Service {
|
|
|
this.task = this.app.config.taskMqConfig;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 店铺系统消息
|
|
|
+ * @param shop_id 店铺id
|
|
|
+ */
|
|
|
+ async shopMsg(shop_id) {
|
|
|
+ const { mq } = this.ctx;
|
|
|
+ const ex = 'shopMsg';
|
|
|
+ try {
|
|
|
+ const ch = await mq.conn.createChannel();
|
|
|
+ await ch.assertExchange(ex, 'direct', { durable: true });
|
|
|
+ await ch.publish(ex, shop_id, Buffer.from('check msg'));
|
|
|
+ await ch.close();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('mq--店铺系统消息--任务队列生成失败');
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 初始化死信机制
|
|
|
async initDeadProcess() {
|
|
|
try {
|