feat(Kafka Node): add key option for messages (#4210)

This commit is contained in:
Jakob Backlund 2022-10-12 17:57:05 +03:00 committed by GitHub
parent cd74c3ebae
commit 1811c54917
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,
},
],
});