n8n and Apache Kafka event workflows

Connect self-hosted n8n to Apache Kafka topics with the built-in Kafka Trigger and Kafka node, planning compression, Schema Registry decoding and security before the first workflow runs.

On this page

How n8n consumes Kafka topics with the built-in Kafka Trigger

n8n consumes Kafka topics with its built-in Kafka Trigger node and publishes messages back with the Kafka node, so no custom consumer code is needed in the workflow layer. The Kafka Trigger starts a workflow for each message it receives on the topic you configure, and the Kafka node writes messages to a topic from any step in a workflow. Both are native nodes that appear on the canvas like any other integration, which keeps the event logic visible to the people who own the business process.

The split of responsibility matters more than the node settings. The Kafka cluster owner decides which brokers and listeners exist, which security mechanism clients must use (SSL or one of the SASL mechanisms), which topics exist and how long they are retained, and which principals hold read or write access through ACLs. The workflow owner decides which topic and consumer group the trigger uses, how each message is parsed and mapped, what happens when a step fails, and how many executions the n8n instance can absorb. Agree these boundaries in writing before the first workflow goes live, and ask the cluster owner for a dedicated client identity for n8n so access can be reviewed and revoked on its own.

Confirm three things with the cluster owner before building. First, that the bootstrap servers n8n will reach are on a listener it can use, with TLS settings your security team has approved. Second, that the n8n principal has read access to the topics and a consumer group permission, since a missing ACL on a KRaft cluster can block access entirely unless the cluster has been configured otherwise. Third, which message format and schema the producers use, because the trigger version and schema decoding settings depend on both. Discovering any of these after workflows are built usually means rework in the workflow, not just a configuration change.

What a Kafka trigger in n8n needs before the first workflow

A Kafka trigger in n8n depends on decisions made outside the workflow: which Kafka release runs the cluster, how clients connect and authenticate, and which n8n and node versions decode the messages. Confirm each item with the owner named on its card before the first workflow is built, because a mismatch usually shows up as a connection or decoding failure rather than a clear error.

Apache Kafka release line

Confirm which Kafka release the brokers run. The downloads page lists 4.3.1, 4.2.2 and 4.1.2 as the supported releases, and older versions are archived. Ask the platform team whether the cluster is on a supported line and whether a bugfix release is pending, since the trigger connects to whatever version the brokers expose. Owner: Kafka platform team.

Kafka downloads

KRaft mode for 4.x clusters

Apache Kafka 4.0 supports only KRaft mode, and ZooKeeper mode has been removed. A cluster still running ZooKeeper must migrate to KRaft before upgrading to 4.x, and KRaft clusters older than 3.3.x should move to 3.9.x first. Confirm the metadata mode with the platform team before the n8n team plans any upgrade-dependent work.

Kafka upgrade notes

Java runtime for clients

Since Kafka 4.0, brokers, Kafka Connect and tools require Java 17, while clients and Kafka Streams applications require at least Java 11. The n8n team does not run Java directly, but any Java-based consumer or producer that sits beside the n8n workflow must meet this floor. Owner: the team that runs the Java services feeding or reading the same topics.

n8n and Kafka Trigger versions

Confirm the n8n version in use and the version of the Kafka Trigger node it exposes. Version 1 consumes uncompressed and GZIP messages but cannot decode LZ4, Snappy or Zstd, while version 2 decodes all four formats. Check compression on the producing side before choosing the node version. Owner: the n8n administrator, with input from the producing team.

Kafka Trigger docs

Broker network reachability

The n8n main instance or worker processing the trigger must reach every advertised broker address, not only the bootstrap address. Confirm that firewall rules, DNS names and any NAT or load balancer in front of the brokers resolve the same way from the n8n network segment. In queue mode, confirm this from each worker that will run the trigger. Owner: network team, with the n8n operator.

TLS and SASL credentials

Kafka supports SSL or SASL for client authentication, with GSSAPI, PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 and OAUTHBEARER as the documented SASL mechanisms. Confirm which mechanism and listener the cluster exposes, and obtain a dedicated service identity with read access to the topic and consumer group. Store the secrets in n8n's credential store, not in workflow fields. Owner: Kafka security administrator.

Kafka security overview

Configuring the Kafka Trigger, credentials and first consumer

This sequence takes a self-hosted n8n instance from an empty credential to an active workflow that consumes a Kafka topic, with a check at each step that confirms the connection, the message format and the consumer group are working before the workflow goes live.

  1. Confirm the cluster, topic and consumer group

    Before touching n8n, the Kafka administrator confirms the bootstrap broker addresses, the topic name, the partition count and the consumer group ID the workflow will use. Ask the platform team which listeners are TLS-enabled and which SASL mechanism the clients must use, since Kafka security is optional and clusters can mix secured and unsecured listeners. The step is done when the team can list the topic and describe the group from a client tool and the n8n host can reach every broker address, not only the bootstrap address.

  2. Create the Kafka credential in n8n

    In n8n, an operator creates a Kafka credential with the broker list, the authentication method (SSL or one of the SASL mechanisms the cluster documents) and any CA certificate or client certificate the listener requires. Store the SASL password and keys only in this credential, never in workflow parameters. The step is done when the credential test succeeds, which confirms that the n8n host can open an authenticated connection to the cluster. If the test fails, check the ACLs for the account, since resources without ACLs are restricted to super users unless the cluster allows otherwise.

  3. Choose the Kafka Trigger version for your formats

    Before adding the trigger, the team checks how producers compress messages. Version 1 of the Kafka Trigger consumes uncompressed and GZIP messages but cannot decode LZ4, Snappy or Zstd, while version 2 decodes all four formats. Select version 2 if any producer uses LZ4, Snappy or Zstd, or if the format is not yet known. The step is done when the producer team confirms the compression codec in writing and the chosen trigger version is recorded in the workflow notes.

  4. Set the topic and consumer group in the trigger

    An operator adds the Kafka Trigger node, attaches the credential, and sets the topic and the consumer group ID agreed in the first step. Give the group a name that identifies this workflow, because the group's committed offsets are what tell you later how far the workflow has read. Decide whether to read from the beginning of the topic or only new messages, and document the choice, since it determines whether a first activation replays existing history. The step is done when the node saves without validation errors.

  5. Enable Schema Registry decoding when required

    If producers serialize messages against a schema, the operator turns on the Use Schema Registry option and selects a Schema Registry credential. The option is intended for an authenticated Confluent Schema Registry, so confirm with the platform team that your registry is of that type and that the n8n host can reach it. Without this step, consumers receive raw payloads that may not parse as JSON. The step is done when a sample message displays decoded field names rather than binary content.

  6. Run a test with sample messages

    Produce a small set of known test messages to the topic from a client tool, using the same compression and serialization as production. In the trigger node, run the test listener and confirm that each message appears with the expected key, value, headers and offset. Include one message per format in use, including any Schema Registry encoded message. The step is done when every test message arrives intact and, after the test, the consumer group shows a committed offset for the topic, which proves that the group is tracking progress.

  7. Activate the workflow and confirm the consumer group

    Connect the trigger to the downstream nodes, save the workflow and activate it. Then check the consumer group from a Kafka client tool and confirm that its committed offset advances as new messages are produced, and that lag does not grow while the workflow is active. Watch the n8n execution log for the first few runs for decoding or authentication errors. The step is done when a message produced after activation shows up as a successful execution and the group's offset moves to match it.

Which Kafka Trigger version decodes your message compression

Version 1 of the Kafka Trigger consumes messages that are uncompressed or compressed with GZIP. If your producers write plain or GZIP payloads, version 1 can read them without additional configuration beyond the usual connection, topic and group settings. This is the simplest case, but it still needs confirmation because the codec is set by the producer, not by n8n.

  • Plain payloads: Uncompressed messages are read directly, with no decoding step needed for compression.
  • GZIP payloads: Version 1 handles GZIP, so these topics can stay on version 1 if nothing else in the payload requires a change.
  • Mixed topics: If one topic receives messages from several producers, confirm that every producer uses one of these two codecs before relying on version 1.
  • Future changes: A producer team may switch codecs during a performance tuning exercise, so the trigger choice should be revisited whenever producer settings change.

Confirm the codec with the Kafka owner and record it next to the workflow so the next person to edit it knows which version was chosen and why.

Decoding Avro and schema-registered messages from Confluent Schema Registry

The Kafka Trigger's Use Schema Registry option is what lets a workflow read messages that producers register in a Confluent Schema Registry. The option needs a Schema Registry credential, and the registry must require authentication for that credential to work. Before building anything, confirm with the platform team which registry the topics use, because this option is documented for Confluent Schema Registry only. If your organization runs a different registry, do not assume the trigger will decode its messages. Test with a sample message from the actual topic and treat any other registry as unconfirmed until you have verified it in your environment.

Schema subjects and compatibility rules belong to the producing team, not to the n8n workflow owner. The producer team usually registers the subjects, chooses the compatibility mode and decides when a new schema version is published. Your workflow depends on those decisions. A change that the registry accepts can still break a running workflow if it removes or renames a field the workflow reads, changes a type, or adds a required field that downstream nodes expect. Agree in writing who owns each subject, which compatibility mode applies, and how the n8n team is notified before a breaking change ships. Ask the registry administrator to confirm these settings for every topic the workflow consumes.

When a producer publishes a new schema version, test the workflow against a message encoded with that version before it reaches production. Check that the trigger still decodes the message, that the fields your expressions reference are present with the expected types, and that a message written with the previous version still decodes if your topic holds a mix of versions. Run the test on a non-production n8n instance connected to a staging topic. Record the schema version ID you tested, so that a later failure can be traced to a specific change. For version-specific behavior of the Kafka Trigger itself, confirm the node version in the n8n Kafka Trigger node documentation before you copy any configuration.

How Kafka events reach an n8n workflow

The path starts with producers writing to topics on the Kafka cluster, which sits in its own trust zone. The n8n Kafka Trigger joins a consumer group and reads messages over the network boundary into the n8n network. When the topic uses an authenticated Confluent Schema Registry, the trigger decodes payloads through a Schema Registry credential before the workflow runs. Check the consumer group name, the TLS and SASL settings on each side of the boundary, and where results leave for external targets.

Kafka events flow into n8n across a trust boundary, with results sent onward or back to Kafka.

When Kafka is a better fit than webhooks for high-volume events

Webhooks suit low-volume, point-to-point calls, while Kafka suits shared event streams that several systems read at their own pace. The choice depends on the producer's existing design, so check what the sending system already publishes before you build a path into n8n.

Event volume and bursts

Webhooks hold each request open until the receiver accepts it, so a sudden burst of events lands directly on the n8n webhook processors. Kafka buffers events on brokers, so n8n consumes at the rate it can handle. Measure peak messages per second and burst duration from the producer, not monthly averages, and test the Kafka Trigger under that load before committing to either path.

Replay through retained offsets

A Kafka topic keeps messages for a configured retention period, and a consumer group can rewind to an earlier offset to reprocess history after a bug fix or a failed workflow. A webhook delivery that n8n fails to process is gone unless the sender retries it. Confirm the topic retention and whether your team needs to reprocess events, and who approves a replay.

Number of independent consumers

When one event must feed n8n, a data warehouse and a fraud service, Kafka lets each consumer group read the same topic without the producer knowing about them. With webhooks, the sender must call each receiver separately and handle each failure. List every consumer that needs the event today and in the next year, because adding a consumer to a topic is usually cheaper than adding a sender integration.

Delivery guarantees the sender can provide

Ask the producing team whether it can retry, deduplicate and confirm delivery. A Kafka producer can wait for broker acknowledgment and retry, but a workflow reading the topic can still process a message twice after a restart, so the n8n workflow must be idempotent. Webhook senders often retry on timeout without guaranteeing order. Document the guarantee each side provides and where duplicates are removed.

Ordering per key

Kafka preserves order only within a partition, so events for one customer or order must share a key to land in the same partition. If your workflow depends on a sequence such as created, updated, then closed, confirm that the producer sets the key and that n8n does not process partitions in ways that break that order. Webhooks deliver in arrival order with no such key model, so out-of-order calls need explicit handling.

Whether the producer already publishes to Kafka

If the source system already writes events to a Kafka cluster, consuming that topic in n8n adds no new producer work and keeps one event path for every team. If the source only offers an HTTP callback, adding Kafka means building a bridge and running a cluster just for n8n. Confirm with the source system's owners whether a topic exists before you design the workflow around one.

Kafka Trigger docs

Mapping Kafka message fields to n8n workflow data

This table maps each Kafka record attribute to what it identifies and how to use it after the Kafka Trigger emits an item. Read it before designing deduplication, routing and validation steps. The main takeaway is that the value is the only part your schema controls, while the other attributes depend on producer settings and must be checked with real sample messages.

Kafka fieldWhat it identifiesHow to use it in n8n
TopicThe topic the record was read fromKeep it if one trigger serves several topics. Confirm the output name in the node docs.
PartitionNumeric partition holding the recordUse for diagnostics. Ordering is guaranteed only within a single partition.
OffsetPosition of the record in its partitionPair with topic and partition as the deduplication key when a workflow retries or replays.
KeyOptional key set by the producerMay be absent or null. Check with sample messages before using it in lookups or routing.
HeadersOptional metadata attached by the producerProducers may omit them. Map only the headers your workflow needs, using a Set node.
TimestampTime assigned to the recordConfirm which timestamp type the output shows, as it depends on broker and producer settings.
ValueMessage payload, decompressed by the nodeVersion 2 decodes LZ4, Snappy and Zstd. Version 1 handles only uncompressed and GZIP. Parse JSON before mapping.
Schema Registry fieldsFields decoded from the registered schemaRequires the Use Schema Registry option and a credential. Schema changes alter the item shape downstream.
Missing or null fieldsOptional fields absent or null in a messageSet defaults with a Set or Code node. Send records missing required fields to an error branch.

Securing the Kafka connection and the workflows that read it

A Kafka trigger in n8n is only as safe as the connection it opens and the people who can change the workflow behind it. The cards below cover the Kafka security model, the ACL and service account choices on the broker side, and the n8n settings that protect stored credentials and sensitive payloads.

Encrypt the Kafka connection with TLS

Kafka security is optional, so a cluster can run unsecured or mix secured and plaintext listeners. For n8n, the trigger and any producer step should connect to a TLS-secured listener only, with the broker CA certificate supplied in the credential. Check that no plaintext listener is advertised to the network segment where n8n workers run, because a worker that connects to the wrong port will send event data unencrypted.

Kafka security overview

Choose a SASL mechanism deliberately

Kafka documents GSSAPI (Kerberos), PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 and OAUTHBEARER for client authentication. SCRAM avoids sending the password in clear text on the wire, while OAUTHBEARER fits organizations that already issue tokens from an identity provider. Confirm which mechanisms your n8n Kafka credential supports in your n8n version before you commit the broker to one.

Restrict access with KRaft ACLs

In KRaft clusters, the StandardAuthorizer stores ACLs in the cluster metadata log. Resources without a matching ACL are restricted to super users unless allow.everyone.if.no.acl.found is set to true. Leave that setting at its default for production topics, and grant read access on each topic and group explicitly, so that a new workflow cannot read a topic by accident.

Kafka authorization docs

Give each consumer group its own account

Create one service account per workflow or per consumer group, with READ access on its topics and the group ID it needs, and nothing else. A shared account means that a compromised or misconfigured workflow can read every topic the account touches. Ask the platform team to name each account after the workflow it serves so that access reviews and revocations are traceable.

Protect credentials with the n8n encryption key

n8n stores credentials in its database encrypted with the instance encryption key. In queue mode, that key must be shared with every worker and webhook processor so they can read the Kafka credentials. Treat the key as a secret held in your secrets manager, rotate access to it when staff or hosts change, and confirm that backups of the n8n database cannot be restored without the key they were written with.

n8n queue mode docs

Control who can edit sensitive workflows

Anyone who can edit a workflow can add a node that writes the payload to an external system or logs it. Limit edit rights on workflows that receive personal or regulated event data to a small group, keep Kafka credentials in a project that those editors cannot export, and review changes to those workflows before they run in production. Role and project controls are part of the n8n SSO and access model, and some of them depend on the plan your organization selects.

Common Kafka Trigger failures and how to fix them

This table lists the failures teams most often hit when a Kafka Trigger runs in n8n, with the likely cause and the first fix to try for each. Read it by matching the symptom you see to the row, then checking the cause in your own cluster and workflow settings.

FailureLikely causeFix
Unreadable payloadsTrigger version 1 cannot decode LZ4, Snappy or Zstd compressed messagesSwitch to Kafka Trigger version 2, which decodes all four formats, then confirm the topic's compression with your producer team
Schema Registry decode errorsMissing Schema Registry credential or Use Schema Registry option not enabledEnable Use Schema Registry and attach a Schema Registry credential that has access to the subject
Schema mismatch on decodeProducer registered a new schema version the workflow was not built againstCheck the subject's version history, test the workflow against the new schema, and agree compatibility rules with producers
Authorization errorsNo ACL grants the consumer principal read access, or the resource falls under super-user-only defaultsGrant the consumer group and topic read permissions with the StandardAuthorizer, and confirm allow.everyone.if.no.acl.found is not relied on for production
TLS handshake failuresCertificate chain incomplete, untrusted CA or hostname mismatch on the broker listenerInstall the full CA chain in the credential, confirm the broker certificate names match, and test the listener with a Kafka client outside n8n
Consumer group rebalancesWorkers joining or leaving, or slow processing that exceeds session timeoutsKeep per-message work short, move long steps to a queue, and avoid restarting several n8n instances at once
Duplicate processing after restartsOffsets were not committed before a restart, so messages are read againMake downstream writes idempotent using a message key or ID, and confirm offset commit behavior in your trigger settings
Trigger fires on the wrong instance (queue mode)Kafka Trigger runs on a main or worker process rather than the instance you expected, or a second main instance also subscribesReview queue mode role assignments, keep one active consumer per group, and check which instance holds the trigger in the execution logs

Questions buyers ask before connecting n8n to Kafka

What drives the cost and effort of connecting n8n to Kafka?

The main drivers are the state of the Kafka cluster, the security model, schema governance, and the number of workflows and message volume. A cluster that is already on a supported release with documented topics and ACLs costs far less to connect than one that needs upgrading or access rules designed first. Authentication with SASL or TLS, a Schema Registry that needs authenticated access, and the number of topics each workflow reads all add build and test work. Your cost is one-time for design, build and testing, plus recurring effort for upgrades and workflow changes. Ask any partner for a quote that lists each topic, the security mechanism, the schema setup and the test plan separately.

Can our team connect n8n to Kafka without outside help?

For a simple case, yes. A team can connect one or two topics with plain messages if it has a Kafka owner who manages topic configuration and ACLs and can provide sample messages. The Kafka Trigger node handles uncompressed, GZIP, LZ4, Snappy and Zstd messages in version 2, so compression is rarely the blocker. Outside help is more useful when schemas are registered in a Schema Registry, when several teams share the cluster, or when the workflows must run under a tested failover and access model. The question to answer internally is who will own the topic, the credential and the workflow after go-live.

How long does a Kafka and n8n integration take?

Duration depends on scope: the number of topics, whether messages are encoded, how many systems the workflows update, and how many environments must be tested. A single topic with plain JSON and a test environment moves much faster than a set of schema-decoded topics feeding several business systems. Ask for a timeline that separates design of topics and access, build of the Kafka Trigger and Producer steps, schema decoding tests, and a staged rollout. Timelines should also account for waiting on ACL changes and access approvals, which are often the longest items. A written scope lets the timeline be checked against each step.

What do we need to provide before the work starts?

You need to name the people who own each topic and ACL, and provide sample messages for every topic the workflows will read or write. You also need access to the Schema Registry if messages are encoded, a Kafka credential with the permissions agreed for each topic, and a test environment that mirrors production topics without exposing live customer data. Confirm the Kafka version and the security listeners in use, since they determine which SASL mechanism or TLS setup the n8n credential must support. Missing sample messages and unclear ACL owners are the most common reasons work slows down.

Does Apache Kafka have a paid edition we need to buy?

No. Apache Kafka is an Apache Software Foundation project released under the Apache License 2.0, and the project itself offers no paid edition. Costs come from the infrastructure you run it on, from any commercial distribution or managed service you choose, and from the people who operate it. Plan for the supported releases listed on the Kafka downloads page, and confirm with your vendor or infrastructure team what hosting, support and operations cost you will carry. The n8n connection itself adds no Kafka license fee.

Does n8n's license affect using it with Kafka inside our business?

n8n is source-available under the Sustainable Use License, not open source under the OSI definition. That license allows use or modification for your own internal business purposes, so connecting n8n to Kafka for internal workflows is within its terms. The license does not allow distributing n8n free of charge for commercial purposes, and files with .ee in their name require an n8n Enterprise License. Confirm with your legal team that your intended use, including any customer-facing or embedded use, fits the license before the design is finalized.

What breaks most often when n8n reads Kafka topics?

The most common failures are mismatched message formats, missing ACLs, and schema decoding that was never tested against real messages. A trigger built for uncompressed or GZIP messages in version 1 will not decode LZ4, Snappy or Zstd, so check the compression on each topic before you choose the node version. Authorization failures often appear when a new consumer group lacks read permission, and the authorizer may restrict resources with no ACL to super users. Build tests that replay sample messages, confirm the consumer group permissions, and verify how the workflow behaves when a message fails to decode.

How DeployOpen scopes and delivers Kafka integrations in n8n

DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure, including n8n workflows that consume and produce Apache Kafka events. Engagements start with a written scope that fixes deliverables and timelines before any build work begins.

How we scope

  • Inventory the Kafka topics, message formats and compression types each workflow must read or write.
  • Confirm which n8n Kafka Trigger version and Schema Registry setup the topics require before design starts.
  • Agree the written scope, deliverables and timelines in writing before any build work begins.

How we build

  • Configure Kafka Trigger and producer nodes with SASL or SSL credentials that match your cluster's security settings.
  • Build Schema Registry decoding and error handling for malformed or unexpected messages in each workflow.
  • Test consumer offsets, retries and duplicate handling against your topics in a non-production environment first.

How we hand over

  • Document each workflow's topics, consumer group, credentials, schema references and failure behavior.
  • Deliver runbooks covering restarts, offset resets, credential rotation and n8n version upgrades.
  • Walk your platform, security and data teams through the build and the test evidence before handover.

How we support

  • Offer ongoing support, upgrades and continuous testing for Kafka-connected n8n workflows as a retainer.
  • Review changes to Kafka client libraries and n8n node versions before they reach production workflows.
  • Retest affected workflows after Kafka or n8n upgrades and report any changes needed in your environment.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.