|
@@ -12,22 +12,20 @@ export class MqService {
|
|
@Config('rabbitmq.url')
|
|
@Config('rabbitmq.url')
|
|
mqUrl: string;
|
|
mqUrl: string;
|
|
|
|
|
|
- system = {
|
|
|
|
- queue: 'system',
|
|
|
|
- ex: 'systemEx',
|
|
|
|
- exType: 'topic',
|
|
|
|
- };
|
|
|
|
- user = {
|
|
|
|
- queue: 'user',
|
|
|
|
- ex: 'userEx',
|
|
|
|
- exType: 'direct',
|
|
|
|
- };
|
|
|
|
|
|
+ @Config('mqQe.system')
|
|
|
|
+ system: any;
|
|
|
|
+ @Config('mqQe.user')
|
|
|
|
+ user: any;
|
|
|
|
+ @Config('mqQe.mission')
|
|
|
|
+ mission: any;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 1.建立通道
|
|
* 1.建立通道
|
|
* 2.声明交换机
|
|
* 2.声明交换机
|
|
* 3.声明队列
|
|
* 3.声明队列
|
|
* 系统队列:system
|
|
* 系统队列:system
|
|
* 用户队列:user
|
|
* 用户队列:user
|
|
|
|
+ * 任务队列:mission
|
|
*/
|
|
*/
|
|
@Init()
|
|
@Init()
|
|
async connect() {
|
|
async connect() {
|
|
@@ -53,6 +51,9 @@ export class MqService {
|
|
channel.assertExchange(this.user.ex, this.user.exType, { durable: true }),
|
|
channel.assertExchange(this.user.ex, this.user.exType, { durable: true }),
|
|
channel.assertQueue(this.user.queue, { durable: true }),
|
|
channel.assertQueue(this.user.queue, { durable: true }),
|
|
channel.bindQueue(this.user.queue, this.user.ex, '*'),
|
|
channel.bindQueue(this.user.queue, this.user.ex, '*'),
|
|
|
|
+ channel.assertExchange(this.mission.ex, this.mission.exType, { durable: true }),
|
|
|
|
+ channel.assertQueue(this.mission.queue, { durable: true }),
|
|
|
|
+ channel.bindQueue(this.mission.queue, this.mission.ex, '*'),
|
|
]);
|
|
]);
|
|
},
|
|
},
|
|
});
|
|
});
|