fix(RabbitMQ Node): Fix issue with arguments not being sent (#9397)

This commit is contained in:
Jon 2024-07-19 11:04:20 +01:00 committed by GitHub
parent bf57f38d1c
commit 1c666e6e7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,6 @@
/* eslint-disable n8n-nodes-base/node-filename-against-convention */ /* eslint-disable n8n-nodes-base/node-filename-against-convention */
import * as amqplib from 'amqplib'; import * as amqplib from 'amqplib';
import type { Options } from 'amqplib';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ICredentialsDecrypted, ICredentialsDecrypted,
@ -265,7 +266,8 @@ export class RabbitMQ implements INodeType {
displayName: 'Arguments', displayName: 'Arguments',
name: 'arguments', name: 'arguments',
placeholder: 'Add Argument', placeholder: 'Add Argument',
description: 'Arguments to add', description:
'Arguments to add, See <a href="https://amqp-node.github.io/amqplib/channel_api.html#channel_publish" target="_blank">here</a> for valid options',
type: 'fixedCollection', type: 'fixedCollection',
typeOptions: { typeOptions: {
multipleValues: true, multipleValues: true,
@ -451,7 +453,13 @@ export class RabbitMQ implements INodeType {
); );
headers = additionalHeaders; headers = additionalHeaders;
} }
queuePromises.push(channel.sendToQueue(queue, Buffer.from(message), { headers }));
queuePromises.push(
channel.sendToQueue(queue, Buffer.from(message), {
headers,
...(options.arguments ? (options.arguments as Options.Publish) : {}),
}),
);
} }
// @ts-ignore // @ts-ignore
@ -519,7 +527,10 @@ export class RabbitMQ implements INodeType {
} }
exchangePromises.push( exchangePromises.push(
channel.publish(exchange, routingKey, Buffer.from(message), { headers }), channel.publish(exchange, routingKey, Buffer.from(message), {
headers,
...(options.arguments ? (options.arguments as Options.Publish) : {}),
}),
); );
} }