Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RabbitMQ Trigger Node): Add options to configure assert of exchanges and queues #8430

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/nodes-base/nodes/RabbitMQ/DefaultOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ export const rabbitDefaultOptions: Array<
default: false,
description: 'Whether the queue will be deleted when the number of consumers drops to zero',
},
{
displayName: 'Assert Exchange',
name: 'assertExchange',
type: 'boolean',
default: true,
description: 'Whether to assert the exchange exists before sending',
},
{
displayName: 'Assert Queue',
name: 'assertQueue',
type: 'boolean',
default: true,
description: 'Whether to assert the queue exists before sending',
},
{
displayName: 'Durable',
name: 'durable',
Expand Down
12 changes: 10 additions & 2 deletions packages/nodes-base/nodes/RabbitMQ/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ export async function rabbitmqConnectQueue(

return await new Promise(async (resolve, reject) => {
try {
await channel.assertQueue(queue, options);
if (options.assertQueue) {
await channel.assertQueue(queue, options);
} else {
await channel.checkQueue(queue);
}

if (options.binding && ((options.binding as IDataObject).bindings! as IDataObject[]).length) {
((options.binding as IDataObject).bindings as IDataObject[]).forEach(
Expand Down Expand Up @@ -106,7 +110,11 @@ export async function rabbitmqConnectExchange(

return await new Promise(async (resolve, reject) => {
try {
await channel.assertExchange(exchange, type, options);
if (options.assertExchange) {
await channel.assertExchange(exchange, type, options);
} else {
await channel.checkExchange(exchange);
}
resolve(channel);
} catch (error) {
reject(error);
Expand Down
Loading