mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
feat(RabbitMQ Trigger Node): Add exchange and routing key options (#7547)
RabbitMQ trigger needs binding for some cases. For example, I need to consume some domain events in my application and they are published with routing key. --------- Co-authored-by: teomane <emre.teoman@bordatech.com>
This commit is contained in:
parent
27cb7c3c63
commit
5aee2b768f
|
@ -76,6 +76,19 @@ export async function rabbitmqConnectQueue(
|
|||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
await channel.assertQueue(queue, options);
|
||||
|
||||
if (options.binding && ((options.binding as IDataObject).bindings! as IDataObject[]).length) {
|
||||
((options.binding as IDataObject).bindings as IDataObject[]).forEach(
|
||||
async (binding: IDataObject) => {
|
||||
await channel.bindQueue(
|
||||
queue,
|
||||
binding.exchange as string,
|
||||
binding.routingKey as string,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
resolve(channel);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
|
|
|
@ -139,6 +139,39 @@ export class RabbitMQTrigger implements INodeType {
|
|||
},
|
||||
description: 'Max number of executions at a time. Use -1 for no limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Binding',
|
||||
name: 'binding',
|
||||
placeholder: 'Add Binding',
|
||||
description: 'Add binding to queu',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
name: 'bindings',
|
||||
displayName: 'Binding',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Exchange',
|
||||
name: 'exchange',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'exchange',
|
||||
},
|
||||
{
|
||||
displayName: 'RoutingKey',
|
||||
name: 'routingKey',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'routing-key',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
...rabbitDefaultOptions,
|
||||
].sort((a, b) => {
|
||||
if (
|
||||
|
|
Loading…
Reference in a new issue