mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
feat(Kafka Node): add key option for messages (#4210)
This commit is contained in:
parent
cd74c3ebae
commit
1811c54917
|
@ -97,6 +97,27 @@ export class Kafka implements INodeType {
|
|||
default: '',
|
||||
description: 'URL of the schema registry',
|
||||
},
|
||||
{
|
||||
displayName: 'Use Key',
|
||||
name: 'useKey',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to use a message key',
|
||||
},
|
||||
{
|
||||
displayName: 'Key',
|
||||
name: 'key',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
useKey: [true],
|
||||
},
|
||||
},
|
||||
placeholder: '',
|
||||
default: '',
|
||||
description: 'The message key',
|
||||
},
|
||||
{
|
||||
displayName: 'Event Name',
|
||||
name: 'eventName',
|
||||
|
@ -331,6 +352,10 @@ export class Kafka implements INodeType {
|
|||
|
||||
const jsonParameters = this.getNodeParameter('jsonParameters', i) as boolean;
|
||||
|
||||
const useKey = this.getNodeParameter('useKey', i) as boolean;
|
||||
|
||||
const key = useKey ? (this.getNodeParameter('key', i) as string) : null;
|
||||
|
||||
let headers;
|
||||
|
||||
if (jsonParameters === true) {
|
||||
|
@ -358,6 +383,7 @@ export class Kafka implements INodeType {
|
|||
{
|
||||
value: message,
|
||||
headers,
|
||||
key,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue