-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
789b237
commit 2c03eb4
Showing
30 changed files
with
925 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ScopeEnum, saveClassMetadata, saveModule, MS_CONSUMER_KEY } from '../'; | ||
import { Scope } from '../annotation'; | ||
|
||
export enum MSListenerType { | ||
RABBITMQ = 'rabbitmq', | ||
MTTQ = 'mttq', | ||
} | ||
|
||
export function Consumer(type: MSListenerType): ClassDecorator { | ||
return (target: any) => { | ||
saveModule(MS_CONSUMER_KEY, target); | ||
saveClassMetadata(MS_CONSUMER_KEY, type, target); | ||
Scope(ScopeEnum.Request)(target); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { MS_CONSUMER_KEY, attachPropertyDataToClass } from '../'; | ||
|
||
export interface RabbitMQListenerOptions { | ||
propertyKey?: string; | ||
queueName?: string; | ||
exchange?: string; | ||
exclusive?: boolean; | ||
durable?: boolean; | ||
maxPriority?: number; | ||
prefetch?: number; | ||
keys?: {[keyName: string]: string}; | ||
routingKey?: string; | ||
consumeOptions?: { | ||
consumerTag?: string; | ||
noLocal?: boolean; | ||
noAck?: boolean; | ||
exclusive?: boolean; | ||
priority?: number; | ||
arguments?: any; | ||
} | ||
} | ||
|
||
export function RabbitMQListener( | ||
queueName: string, | ||
options: RabbitMQListenerOptions = {} | ||
): MethodDecorator { | ||
return (target: any, propertyKey: string) => { | ||
options.queueName = queueName; | ||
options.propertyKey = propertyKey; | ||
attachPropertyDataToClass(MS_CONSUMER_KEY, options, target, propertyKey); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.