mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
⚡ Allow fromBeginning config in kafka trigger node (#1958)
* Allow fromBeginning config in kafka trigger node * make sure options in defined
This commit is contained in:
@@ -70,6 +70,13 @@ export class KafkaTrigger implements INodeType {
|
|||||||
default: false,
|
default: false,
|
||||||
description: 'Allow sending message to a previously non exisiting topic .',
|
description: 'Allow sending message to a previously non exisiting topic .',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Read messages from beginning',
|
||||||
|
name: 'fromBeginning',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
description: 'Read message from beginning .',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'JSON Parse Message',
|
displayName: 'JSON Parse Message',
|
||||||
name: 'jsonParseMessage',
|
name: 'jsonParseMessage',
|
||||||
@@ -141,12 +148,12 @@ export class KafkaTrigger implements INodeType {
|
|||||||
|
|
||||||
await consumer.connect();
|
await consumer.connect();
|
||||||
|
|
||||||
await consumer.subscribe({ topic, fromBeginning: true });
|
const options = this.getNodeParameter('options', {}) as IDataObject;
|
||||||
|
|
||||||
|
await consumer.subscribe({ topic, fromBeginning: (options.fromBeginning)? true : false });
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
const options = this.getNodeParameter('options', {}) as IDataObject;
|
|
||||||
|
|
||||||
const startConsumer = async () => {
|
const startConsumer = async () => {
|
||||||
await consumer.run({
|
await consumer.run({
|
||||||
eachMessage: async ({ topic, message }) => {
|
eachMessage: async ({ topic, message }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user