mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
feat(RabbitMQ Trigger Node): Add options to configure assert of exchanges and queues (#8430)
This commit is contained in:
parent
ee5e422094
commit
4b3659f04f
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue