mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(RabbitMQ Trigger Node): Add options to configure assert of exchanges and queues (#8430)
This commit is contained in:
@@ -72,6 +72,20 @@ export const rabbitDefaultOptions: Array<
|
|||||||
default: false,
|
default: false,
|
||||||
description: 'Whether the queue will be deleted when the number of consumers drops to zero',
|
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',
|
displayName: 'Durable',
|
||||||
name: 'durable',
|
name: 'durable',
|
||||||
|
|||||||
@@ -75,7 +75,11 @@ export async function rabbitmqConnectQueue(
|
|||||||
|
|
||||||
return await new Promise(async (resolve, reject) => {
|
return await new Promise(async (resolve, reject) => {
|
||||||
try {
|
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) {
|
if (options.binding && ((options.binding as IDataObject).bindings! as IDataObject[]).length) {
|
||||||
((options.binding as IDataObject).bindings as IDataObject[]).forEach(
|
((options.binding as IDataObject).bindings as IDataObject[]).forEach(
|
||||||
@@ -106,7 +110,11 @@ export async function rabbitmqConnectExchange(
|
|||||||
|
|
||||||
return await new Promise(async (resolve, reject) => {
|
return await new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
await channel.assertExchange(exchange, type, options);
|
if (options.assertExchange) {
|
||||||
|
await channel.assertExchange(exchange, type, options);
|
||||||
|
} else {
|
||||||
|
await channel.checkExchange(exchange);
|
||||||
|
}
|
||||||
resolve(channel);
|
resolve(channel);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user