Skip to content

Commit

Permalink
feat: add option for arguments when binding queue to an exchange (#346)
Browse files Browse the repository at this point in the history
fixes #343
  • Loading branch information
jlally21 authored Dec 17, 2021
1 parent d47ea96 commit c561e73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/rabbitmq/src/amqp/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,23 @@ export class AmqpConnection {
actualQueue = queue;
}

let bindQueueArguments: any;
if (subscriptionOptions.queueOptions) {
bindQueueArguments = subscriptionOptions.queueOptions.bindQueueArguments;
}

const routingKeys = Array.isArray(routingKey) ? routingKey : [routingKey];

if (exchange && routingKeys) {
await Promise.all(
routingKeys.map((routingKey) => {
if (routingKey != null) {
channel.bindQueue(actualQueue as string, exchange, routingKey);
channel.bindQueue(
actualQueue as string,
exchange,
routingKey,
bindQueueArguments
);
}
})
);
Expand Down
1 change: 1 addition & 0 deletions packages/rabbitmq/src/rabbitmq.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface QueueOptions {
deadLetterRoutingKey?: string;
maxLength?: number;
maxPriority?: number;
bindQueueArguments?: any;
}

export interface MessageHandlerOptions {
Expand Down

0 comments on commit c561e73

Please sign in to comment.