---
schema_version: "1"
id: a80bcc2edf22ec0c2875eb7155aa04da678e826a89971680b66c243f50d7d7ec
title: Upgrading and Migrating Apache Kafka Connector to 4.x
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/kafka-connector/4.10/kafka-connector-upgrade-migrate.md
canonical_url: https://docs.mulesoft.com/kafka-connector/4.10/kafka-connector-upgrade-migrate
source_site: docs.mulesoft.com
content_type: documentation
content_hash: ef73af0d1d59a2c3750a71217d447192bc7cc44dc434fa7ff586fcf58c280771
description: MuleSoft Documentation Site
release: "4.10"
latest: false
---
---
product: Apache Kafka Connector
version: 4.10
---

# Upgrading and Migrating Apache Kafka Connector to 4.x

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Upgrade Anypoint Connector for Apache Kafka (Apache Kafka Connector) to version 4.x.

## Supported Upgrade Paths

<table><colgroup><col> <col></colgroup><thead><tr><th>From Version</th><th>To Version</th></tr></thead><tbody><tr><td><div><div><p>3.2.x</p></div></div></td><td><div><div><p>4.x</p></div></div></td></tr></tbody></table>

## Changes in This Release

Apache Kafka Connector 4.x contains a lot of changes to improve efficiency, including new operations
to enable you to better understand how to use the connector.

All of the changes included in this version break backward compatibility.

This release contains the following changes:

- Four new operations with new parameters were added:

  - Commit  
    This operation commits the offsets associated with a message or batch of messages consumed in a
    Message Listener (Source) or in a Batch Message Listener (Source). This operation works only
    with MANUAL Ack mode.

  - Consume  
    This operation is used for receiving messages from one or more Kafka topics. The Consume
    operation works similarly to the Message Listener source, so all the operations that apply to
    the Message Listener source also apply to this operation.

  - Publish  
    This operation enables sending messages to a Kafka topic. It is non-blocking, and its behavior
    depends on specific values of the connection parameters. This operation supports transactions,
    so a transaction ID is randomly generated for the Kafka Producer.

  - Seek  
    This operation is used for setting the current offset of the consumer for a given topic and
    partition to the provided offset value.  
    See the [New Operations](#new_operations) table.

- The Message Listener replaces the Message Consumer source.  
  See the [Changed Sources](#changed_sources) table.

- Added a Batch Message Listener source, which works in a similar way as the Message Listener with
  the difference that it processes the list of messages instead of a single message at a time. The
  message list obtained in the poll is handled by the Mule flow as a single event.  
  See the [New Sources](#new_sources) table for information about the new parameters.

- Added different acknowledgment modes in the consumer configuration, including:

  - AUTO  
    Mule acknowledges the message only if the flow is finished successfully.

  - MANUAL  
    The user must manually acknowledge the message within the flow.

  - DUPS\_OK  
    Same as the AUTO mode, but the commit is made asynchronously, which can result in duplicate
    records.

  - IMMEDIATE  
    Mule automatically acknowledges the message upon receipt.

- There is now one plaintext connection type that supports transactions.

  In version 3.x of the connector, you could add a customizable set of configuration properties
  related to connections. In version 4.x of the connector, this feature was removed. The connector
  now has a set of connection types for which you can set properties.

## Changed Sources

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Kafka Source</th><th>Earlier version</th><th>Parameters</th></tr></thead><tbody><tr><td><p>Message Listener</p></td><td><p>Message consumer</p></td><td><div><div><ul><li><p>Poll timeout</p></li><li><p>Poll timeout time unit</p></li><li><p>Acknowledgment mode</p></li><li><p>Number of parallel consumers</p></li></ul></div></div></td></tr></tbody></table>

## New Operations

This release contains the following new operations:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Kafka Operation</th><th>Description</th><th>Parameters</th></tr></thead><tbody><tr><td><p>Commit</p></td><td><div><div><p>Commits the offsets associated to a message or batch of messages consumed in a Message Listener.</p></div></div></td><td><div><div><p>Consumer commit key. The consumer commit key to use to commit the message.</p></div></div></td></tr><tr><td><p>Consume</p></td><td><div><div><p>Enables receiving messages from one or more Kafka topics. It works similarly to the Message Listener source, so all the operations that apply to the Message Listener source also apply to this operation.</p></div><div><div data-type="NOTE">You must specify the timeout parameter, or the flow will be blocked.</div></div></div></td><td><div><div><ul><li><p>Consumption timeout</p></li><li><p>Timeout time unit</p></li></ul></div></div></td></tr><tr><td><p>Publish</p></td><td><div><div><p>Enables sending messages to a Kafka topic, and is non-blocking. Its behavior depends on specific values of the connection parameters. This operation supports transactions, which means that a transaction ID is randomly generated for the Kafka producer and handled in the connection.</p></div><div><div data-type="NOTE">You must specify the timeout parameter, or the flow will be blocked.</div></div></div></td><td><div><div><ul><li><p>Topic (The topic name)</p></li><li><p>Partition (The partition name)</p></li><li><p>Key</p></li><li><p>Message</p></li><li><p>Headers</p></li></ul></div></div></td></tr><tr><td><p>Seek</p></td><td><div><div><p>Sets the current offset of the consumer for the given topic and partition to the provided offset value.</p></div><div><div data-type="NOTE">You must specify the timeout parameter, or the flow will be blocked.</div></div></div></td><td><div><div><ul><li><p>Topic (The topic name)</p></li><li><p>Partition (The partition name)</p></li><li><p>Offset (The offset to seek to)</p></li></ul></div></div></td></tr></tbody></table>

> [!NOTE] With the exception of the Commit operation, the flow will be blocked if the `timeout`
> parameter is not specified.

## New Sources

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Kafka Operation</th><th>Description</th><th>Parameters</th></tr></thead><tbody><tr><td><p>Batch Message Listener</p></td><td><div><div><p>Works in the same way as the Message Listener except that it processes the list of messages instead of processing a single message at a time. The message list that was obtained in the poll is handled by a flow as a single event, so the handling of concurrency is simpler than in the simple Message Listener. In other words, a commit of the messages happens for all the messages as a whole by calling the commit on the Kafka consumer.</p></div></div></td><td><div><div><ul><li><p>Poll timeout</p></li><li><p>Poll timeout time unit</p></li><li><p>Acknowledgment mode</p></li><li><p>Number of parallel consumers</p></li></ul></div></div></td></tr></tbody></table>

## Upgrade Prerequisites

Before you perform the upgrade, you must create a backup of your files, data, and configurations in
case you need to revert to the previous version.

## Upgrade Steps

Follow these steps to perform the upgrade to Apache Kafka Connector 4.0.x:

1.  In Studio, create a Mule project.

2.  In the Mule Palette view, click **Search in Exchange**.

3.  In Add Modules to Project, type 'Apache Kafka' in the search field.

4.  In Available modules, select **Apache Kafka Connector** and then click **Add**.

5.  Click **Finish**.  
    Anypoint Studio upgrades the connector automatically.

6.  Verify that the `kafka-connector` dependency version is `4.0.0` in the pom.xml.

## Post Upgrade Steps

After you install the latest version of the connector, follow these steps to complete the upgrade:

1.  In Anypoint Studio, verify that there are no errors in the **Problems** or **Console** views.

2.  Check the project pom.xml and verify that there are no problems.

3.  Test the connection and verify that the operations work.

## Troubleshooting

If there are problems with caching the parameters and caching the metadata, try restarting Anypoint
Studio.

### Reverting the Upgrade

If it is necessary to revert to the previous version of Apache Kafka Connector, in Anypoint Studio,
change the `kafka-connector` dependency version `4.0.0` in the project’s pom.xml to the previous
version.

## See Also

- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)

- [Salesforce Help](https://help.salesforce.com)
