Skip to content

Commit 71af745

Browse files
authored
Support exclusive Connection per listener
1 parent 458b1b8 commit 71af745

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/core/infrastructure/events/Listener.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ export abstract class Listener<T> implements ListenerContract {
1212
protected extraQueues: any = {};
1313
abstract exchange: string;
1414
abstract topic: string;
15+
protected exclusiveConnection: boolean = false;
1516

17+
// FIXME: support exclusive connection per listener
1618
constructor() {
17-
this.connection = Connection.getConnection("listener");
19+
this.connection = Connection.getConnection(this.connectionName);
1820
}
1921

2022
init() {
@@ -61,6 +63,10 @@ export abstract class Listener<T> implements ListenerContract {
6163
return queue.join('.');
6264
}
6365

66+
get connectionName(): string {
67+
return this.exclusiveConnection ? this.constructor.name : 'listener';
68+
}
69+
6470
protected parseMessage(msg: any) {
6571
const json = msg.content.toString();
6672
return JSON.parse(json);

0 commit comments

Comments
 (0)