<a id="cc-couchbase-source"></a>

# Get Started with the Couchbase Source Connector for Confluent Cloud

The fully managed Couchbase Source connector for Confluent Cloud moves data from a
Couchbase server into an Apache Kafka® cluster. The connector configures and
consumes change stream event documents and publishes them to a Kafka topic.

#### NOTE
* If you require private networking for fully managed connectors, make sure to set up the proper
  networking beforehand. For more information, see [Manage Networking for Confluent Cloud Connectors](../networking/internet-resource.md#clusters-connect-cloud).

## Features

The connector offers the following features:

* **At least once delivery**: The connector guarantees that records are delivered at least once to the Kafka topic.
* **Topics created automatically**: The connector automatically creates Kafka topics using the naming
  convention: `${bucket}.${scope}.${collection}`. For more information,
  see [Maximum message size](#cc-couchbase-source-topic-sizing). Note that if you want to create topics with specific
  settings, create the topics before running this connector.
* **Database authentication:** Uses password authentication.
* **Output data formats:** Supports AVRO, BSON, JSON, JSON_SR or PROTOBUF output
  data. [Schema Registry](../../get-started/schema-registry.md#cloud-sr-config) must be enabled to use a Schema Registry-based format (
  for example, AVRO, JSON_SR (JSON Schema), or PROTOBUF).
* **Large size records:** Supports CouchDB documents up to 20 MB in size on Dedicated Kafka clusters and 8 MB on other clusters.
* **Offset management capabilities**: The connector supports offset management. For more information, see [Manage custom offsets](#cc-couchbase-source-custom-offsets).

For more information and examples to use with the Confluent Cloud API for Connect,
see the [Confluent Cloud API for Connect Usage Examples](../connect-api-section.md#ccloud-connect-api) section.

## Limitations

Be sure to review the following information.

* For connector limitations, see [Couchbase Source](../limits.md#cc-couchbase-db-source-limits) limitations.
* If you plan to use one or more Single Message Transformations (SMTs), see [SMT Limitations](../single-message-transforms.md#cc-single-message-transforms-limitations).

<a id="cc-couchbase-source-topic-sizing"></a>

## Maximum message size

This connector creates topics automatically. When it creates topics, the internal connector configuration property `max.message.bytes` is set to the following:

* Basic cluster: `8 MB`
* Standard cluster: `8 MB`
* Enterprise cluster: `8 MB`
* Dedicated cluster: `20 MB`

For more information about Confluent Cloud clusters, see [Kafka Cluster Types in Confluent Cloud](../../clusters/cluster-types.md#cloud-cluster-types).

<a id="cc-couchbase-source-custom-offsets"></a>

## Manage custom offsets

You can manage the offsets for this connector. Offsets provide information on the
point in the system from which the connector is accessing data. For more
information, see [Manage Offsets for Fully Managed Connectors in Confluent Cloud](../offsets.md#connect-custom-offsets).

**To manage offsets**:

- Manage offsets using Confluent Cloud APIs. For more information, see [Connect offsets API reference](https://docs.confluent.io/cloud/current/ccloud/offsets-connect-v-1/).

### Get the current offset

To get the current offset, make a `GET` request that specifies the environment, Kafka cluster, and connector name.

```bash
GET /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets
Host: https://api.confluent.cloud
```

**Response:**

Successful calls return HTTP `200` with a JSON payload that describes the offset.

```json
{
  "id":"lcc-example123",
  "name":"CouchbaseSourceConnector_0",
  "offsets":[
    {
      "partition":{
        "bucket":"bug-bash-bucket",
        "partition":"248"
      },
      "offset":{
        "bySeqno":274,
        "collectionsManifestUid":3,
        "snapshotEndSeqno":388,
        "snapshotStartSeqno":0,
        "vbuuid":182783710637986
      }
    }
  ],
  "metadata":{
    "observed_at":"2025-06-17T07:18:42.537181086Z"
  }
}
```

Responses include the following information:

- The position of latest offset.
- The observed time of the offset in the metadata portion of the payload. The `observed_at` time
  indicates a snapshot in time for when the API retrieved the offset. A running connector is always updating
  its offsets. Use `observed_at` to get a sense for the gap between real time and the time at which the request
  was made. By default, offsets are observed every minute. Calling `GET` repeatedly will fetch more recently
  observed offsets.
- Information about the connector.

### Update the offset

To update the offset, make a `POST` request that specifies the environment, Kafka cluster, and connector
name. Include a JSON payload that specifies new offset and a patch type.

```bash
POST /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets/request
Host: https://api.confluent.cloud

 {
   "type":"PATCH",
   "offsets":[
     {
       "partition":{
         "bucket":"bug-bash-bucket",
         "partition":248
       },
       "offset":{
         "bySeqno":274,
         "collectionsManifestUid":3,
         "snapshotEndSeqno":388,
         "snapshotStartSeqno":0,
         "vbuuid":182783710637986
       }
     }
   ]
 }
```

Considerations:

- You can only make one offset change at a time for a given connector.
- This is an asynchronous request. To check the status of this request, you must use the check offset status API. For more information,
  see **Get the status of an offset request**.
- For source connectors, the connector attempts to read from the position defined by the requested offsets.

**Response:**

Successful calls return HTTP `202 Accepted` with a JSON payload that describes the offset.

```json
{
  "id":"lcc-example123",
  "name":"CouchbaseSourceConnector_0",
  "offsets":[
    {
      "partition":{
        "bucket":"bug-bash-bucket",
        "partition":248
      },
      "offset":{
        "bySeqno":274,
        "collectionsManifestUid":3,
        "snapshotEndSeqno":388,
        "snapshotStartSeqno":0,
        "vbuuid":182783710637986
      }
    }
  ],
  "requested_at":"2025-06-17T07:42:05.262838267Z",
  "type":"PATCH"
}
```

Responses include the following information:

- The requested position of the offsets in the source.
- The time of the request to update the offset.
- Information about the connector.

### Delete the offset

To delete the offset, make a `POST` request that specifies the environment, Kafka cluster, and connector
name. Include a JSON payload that specifies the delete type.

```bash
 POST /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets/request
 Host: https://api.confluent.cloud

{
  "type": "DELETE"
}
```

Considerations:

- Delete requests delete the offset for the provided partition and reset to the base state. A
  delete request is as if you created a fresh new connector.
- This is an asynchronous request. To check the status of this request, you must use the check offset status API. For more information,
  see **Get the status of an offset request**.
- Do not issue delete and patch requests at the same time.
- For source connectors, the connector attempts to read from the position defined in the base state.

**Response**:

Successful calls return HTTP `202 Accepted` with a JSON payload that describes the result.

```json
{
  "id": "lcc-example123",
  "name": "CouchbaseSourceConnector_0",
  "offsets": [],
  "requested_at": "2025-06-28T17:59:45.606796307Z",
  "type": "DELETE"
}
```

Responses include the following information:

- Empty offsets.
- The time of the request to delete the offset.
- Information about the Kafka cluster and connector.
- The type of request.

### Get the status of an offset request

To get the status of a previous offset request, make a `GET` request that specifies the environment, Kafka cluster, and connector
name.

```bash
GET /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets/request/status
Host: https://api.confluent.cloud
```

Considerations:

- The status endpoint always shows the status of the most recent PATCH/DELETE operation.

**Response**:

Successful calls return HTTP `200` with a JSON payload that describes the result. The following is an example
of an applied patch.

```json
{
   "request":{
     "id":"lcc-example123",
     "name":"CouchbaseSourceConnector_0",
     "offsets":[
       {
         "partition":{
           "bucket":"bug-bash-bucket",
           "partition":248
         },
         "offset":{
           "bySeqno":274,
           "collectionsManifestUid":3,
           "snapshotEndSeqno":388,
           "snapshotStartSeqno":0,
           "vbuuid":182783710637986
         }
       }
     ],
     "requested_at":"2025-06-17T07:42:05.262838267Z",
     "type":"PATCH"
   },
   "status":{
     "phase":"APPLIED",
     "message":"The Connect framework-managed offsets for this connector have been altered successfully. However, if this connector manages offsets externally, they will need to be manually altered in the system that the connector uses."
   },
   "previous_offsets":[
     {
       "partition":{
         "bucket":"bug-bash-bucket",
         "partition":"248"
       },
       "offset":{
         "bySeqno":274,
         "collectionsManifestUid":3,
         "snapshotEndSeqno":388,
         "snapshotStartSeqno":0,
         "vbuuid":182783710637986
       }
     }
   ],
   "applied_at":"2025-06-17T07:42:07.749486627Z"
 }
```

Responses include the following information:

- The original request, including the time it was made.
- The status of the request: applied, pending, or failed.
- The time you issued the status request.
- The previous offsets. These are the offsets that the connector last updated
  prior to updating the offsets. Use these to try to restore the state of your connector
  if a patch update causes your connector to fail or to return a connector to its
  previous state after rolling back.

### JSON payload

The table below offers a description of the unique fields in the JSON payload for managing offsets of the
Couchbase Source connector.

| Field   | Definition                                                                                                                                                                                                        | Required/Optional   |
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|
| `ns`    | `ns` is the connection string, including the connection host. If the configuration file for<br/>the connector includes a value in `offset.partition.name`, the value in `offset.partition.name` is used for `ns`. | Required            |
| `_id`   | `_id` is the `_data` field from the source record in Couchbase.                                                                                                                                                   | Required            |

## Quick Start

Use this quick start to get up and running with the Confluent Cloud Couchbase
Source connector. The quick start provides the basics of selecting the connector
and configuring it to consume data from Couchbase DB and persist the data to Kafka.

<a id="cc-couchbase-source-prereqs"></a>

Prerequisites
: - Authorized access to a [Confluent Cloud](https://www.confluent.io/confluent-cloud/) cluster
    on Amazon Web Services (AWS), Microsoft Azure (Azure), or Google Cloud.
  - The Confluent CLI installed and configured for the cluster.
    For more information, see [Install the Confluent CLI](https://docs.confluent.io/confluent-cli/current/install.html).
  - [Schema Registry](../../get-started/schema-registry.md#cloud-sr-config) must be enabled to use a Schema Registry-based format
    (for example, AVRO, JSON_SR (JSON Schema), or PROTOBUF).
  - Access to a Couchbase server.
  - The connector automatically creates Kafka topics using the naming convention: `${bucket}.${scope}.${collection}`.
  - For networking considerations, see [Networking and DNS](../overview.md#connect-internet-access-resources).
    To use a set of public egress IP addresses, see [Public Egress IP Addresses for Confluent Cloud Connectors](../static-egress-ip.md#cc-static-egress-ips).
  <br/>
  - Kafka cluster credentials. The following lists the different ways you can provide credentials.
    - Enter an existing [service account](../service-account.md#s3-cloud-service-account) resource ID.
    - Create a Confluent Cloud [service account](../service-account.md#s3-cloud-service-account) for the connector. Make sure to review the ACL entries required in the [service account documentation](../service-account.md#s3-cloud-service-account). Some connectors have specific ACL requirements.
    - Create a Confluent Cloud API key and secret. To create a key and secret, you can use [confluent api-key create](https://docs.confluent.io/confluent-cli/current/command-reference/api-key/confluent_api-key_create.html) *or* you can autogenerate the API key and secret directly in the Cloud Console when setting up the connector.

### Using the Confluent Cloud Console

#### Step 1: Launch your Confluent Cloud cluster

To create and launch a Kafka cluster in Confluent Cloud, see [Create a kafka cluster in Confluent Cloud](../../get-started/index.md#cloud-create-kafka-cluster).

#### Step 2: Add a connector

In the left navigation menu, click **Connectors**. If you already have connectors in your cluster, click **+ Add
connector**.

#### Step 3: Select your connector

Click the **Couchbase Source** connector card.

![Couchbase Source Connector Card](images/ccloud-couchbase-source-icon.png)

<a id="cc-couchbase-source-setup-connection"></a>

#### Step 4: Enter the connector details

#### NOTE
* Make sure you have all your [prerequisites](#cc-couchbase-source-prereqs) completed.
* An asterisk ( \* ) designates a required entry.

At the **Couchbase Source Connector** screen, complete the following:

### Kafka access

1. Select the way you want to provide **Kafka Cluster credentials**. You can
   choose one of the following options:
   - **My account**: This setting allows your connector to globally access everything
     that you have access to. With a user account, the connector uses an API key and
     secret to access the Kafka cluster. This option is not recommended for production.
   - **Service account**: This setting limits the access for your connector by using a
     [service account](../service-account.md#s3-cloud-service-account). This option is recommended for
     production.
   - **Use an existing API key**: This setting allows you to specify an API key and a
     secret pair. You can use an existing pair or create a new one. This method is not
     recommended for production environments.

   #### NOTE
   Freight clusters support only service accounts for Kafka authentication.
2. Click **Continue**.

### Authentication

1. Configure the authentication properties:

   **Connection**
   - **Couchbase Seed Nodes**: A comma-separated addresses of Couchbase Server nodes.
     If a custom port is specified, it must be the KV port (which is normally `11210` for
     insecure connections, or `11207` for secure connections).
   - **Couchbase Username**: The name of the Couchbase user connecting to the Couchbase database.
   - **Couchbase Password**: The password of the Couchbase user connecting to the Couchbase database.
     This value may be overridden by the `KAFKA_COUCHBASE_PASSWORD` environment variable.
   - **Couchbase Bucket**: Name of the Couchbase bucket to use. This property is required
     unless using the experimental `AnalyticsSinkHandler`.
2. Click **Continue**.

### Configuration

**Output messages**

- **Output Kafka record value format**: Sets the output Kafka record value
  format (data going to the Kafka topic). Valid entries are AVRO, BSON, JSON,
  JSON_SR (JSON Schema), or PROTOBUF. Note that you
  need to have [Schema Registry](../../get-started/schema-registry.md#cloud-sr-config) configured if using
  a schema-based message format like AVRO, JSON_SR, and PROTOBUF.

  #### NOTE
  When you set the output Kafka record value format to JSON_SR, AVRO, or PROTOBUF,
  only the metadata in the payload has a schema; the Couchbase document itself is schema-less.

**Source Behavior**

- **Default Kafka Topic**: Name of the default Kafka topic to publish data to for collections
  that do not have an entry in the `couchbase.collection.to.topic` map.
  This is a format string that recognizes the following placeholders:
  - `${bucket}` refers to the bucket containing the document.
  - `${scope}` refers to the scope containing the document.
  - `${collection}` refers to the collection containing the document.
- **Collection to Topic Map**: A comma-delimited map from Couchbase collection to Kafka topic.
  Collection and Topic are joined by an equals sign (=). For example, to write messages
  from collection `"scope-a.invoices"` to topic `"topic1"`, and messages from collection
  `"scope-a.widgets"` to topic `"topic2"`, you would
  write `"scope-a.invoices=topic1,scope-a.widgets=topic2"`. Defaults to an empty map.
  For collections not present in this map, the destination topic is determined by
  the `couchbase.topic` configuration property.
- **Source Handler Class**: The fully-qualified class name of the source handler to use.
  The source handler determines how the Couchbase document is converted
  into a Kafka record. To publish JSON messages identical to the Couchbase
  documents, use `com.couchbase.connect.kafka.handler.source.RawJsonSourceHandler`
  and set `value.converter` to `org.apache.kafka.connect.converters.ByteArrayConverter`.
  When using a custom source handler that filters out certain messages, consider
  also configuring `couchbase.black.hole.topic` as mentioned below.
- **Metadata Headers**: A comma-delimited list of Couchbase metadata headers to add to records. Valid values are:
  - `bucket`: Name of the bucket the document came from.
  - `scope`: Name of the scope the document came from.
  - `collection`: Name of the collection the document came from.
  - `key`: The Couchbase document ID.
  - `qualifiedKey`: The document’s scope, collection, and document ID, delimited by dots.
    For example, `myScope.myCollection.myDocumentId`.
  - `cas`: The document’s “compare and swap” value.
  - `partition`: The index of the Couchbase partition the document came from.
  - `partitionUuid`: Identifies the history branch of the partition the document came from.
  - `seqno`: The DCP sequence number of the event.
  - `rev`: The revision number of the event.
  - `expiry`: The epoch second when the document expires, or `null` if the document has no expiry or if the event is a deletion.
- **Header Name Prefix**: The connector prepends this value to header names to prevent
  collision with headers set by other parts of the system. For example,
  if `couchbase.headers` is set to `bucket,qualifiedKey` and `header.name.prefix`
  is set to `example`, then records will have headers named `example.bucket` and `example.qualifiedKey`.
- **Event Filter Class**: The class name of the event filter to use. The event filter determines
  whether a database change event is ignored. As of version `4.2.4`, the
  default filter ignores events from the Couchbase `_system` scope. If
  you are interested in those events too, set this property to
  `com.couchbase.connect.kafka.filter.AllPassIncludingSystemFilter`.
  For more information, see `couchbase.black.hole.topic` property.
- **Black Hole Topic**: If this property is non-blank, the connector publishes a tiny synthetic
  record to this topic whenever the `Filter` or `SourceHandler` ignores a source
  event. This lets the connector tell the Kafka Connect framework about the
  source offset of the ignored event. Configure this topic to use small
  segments and the lowest possible retention settings.
- **Initial Offset Topic**: When `couchbase.stream.from` is set to `SAVED_OFFSET_OR_NOW` and
  this property is not blank:
  - On startup, the connector publishes a synthetic record to the specified
    topic for each source partition that does not yet have a saved offset.
  - This action lets connector initialize those missing source offsets to `now` (the current state of Couchbase).
- **Batch Size**: Controls the maximum size of the batch for writing into a topic.
- **Stream From**: Controls when in the history the connector starts streaming from.
- **Scope**: If you wish to stream from all collections within a scope, specify
  the scope name here. Requires Couchbase Server `7.0` or later.
- **Collections**: If you wish to stream from specific collections, specify the
  qualified collection names here, separated by commas. A qualified
  name is the name of the scope followed by a dot (.) and then the
  name of the collection. For example, “tenant-foo.invoices”.
  * If you specify neither `couchbase.scope` nor `couchbase.collections`,
    the connector will stream from all collections of all scopes in the bucket.
  * Requires Couchbase Server 7.0 or later.

### **Show advanced configurations**

- **Schema context**: Select a schema context to use for this connector, if using
  a schema-based data format. This property defaults to the **Default** context,
  which configures the connector to use the default schema set up for Schema Registry in your
  Confluent Cloud environment. A schema context allows you to use separate schemas (like
  schema sub-registries) tied to topics in different Kafka clusters that share the
  same Schema Registry environment. For example, if you select a non-default context, a
  **Source** connector uses only that schema context to register a schema and a
  **Sink** connector uses only that schema context to read from. For more
  information about setting up a schema context, see [What are schema contexts and when should you use them?](../../sr/faqs-cc.md#faq-schema-contexts).

**Additional Configs**

- **Value Converter Decimal Format**: Specifies the `JSON` or `JSON_SR` serialization format for Connect `DECIMAL` logical type values with two allowed literals:
  `BASE64` to serialize `DECIMAL` logical types as base64 encoded binary data, and
  `NUMERIC` to serialize `DECIMAL` logical type values in `JSON` or `JSON_SR` as a number representing the decimal value.
- **Value Converter Replace Null With Default**: Specifies whether to replace fields that have a default value and that are null to the default value. When set to `true`, the connector uses the default value; otherwise, it uses `null`. Applies to the `JSON` converter.
- **Key Converter Schema ID Serializer**: The class name of the schema ID serializer for keys. This is used to serialize schema IDs in the message headers.
- **Value Converter Reference Subject Name Strategy**: Sets the subject reference name strategy for values. Valid entries are `DefaultReferenceSubjectNameStrategy` or `QualifiedReferenceSubjectNameStrategy`. You can use this strategy only with `PROTOBUF` format; the default strategy is `DefaultReferenceSubjectNameStrategy`.
- **Value Converter Schemas Enable**: Includes schema within each of the serialized values. Input messages must contain `schema` and `payload` fields and must not contain additional fields. For plain `JSON` data, set this to `false`. Applies to the `JSON` converter.
- **Errors Tolerance**: Use this property to configure the connector’s error handling behavior.

  #### WARNING
  Use this property with caution for sink connectors, as it can lead to data loss. If you set this property to `all`, the connector does not fail on errant records, but logs them (and sends to DLQ for sink connectors) and continues processing. If you set this property to `none`, the connector task fails on errant records.
- **Value Converter Connect Meta Data**: Enables the Connect converter to add its metadata to the output schema. Applies to Avro converters.
- **Value Converter Value Subject Name Strategy**: Determines how to construct the subject name under which the value schema is registered with Schema Registry.
- **Key Converter Key Subject Name Strategy**: Determines how to construct the subject name for key schema registration.
- **Value Converter Ignore Default For Nullables**: When set to `true`, this property ensures that the corresponding record in Kafka is `null`, instead of showing the default column value. Applies to the `AVRO`, `PROTOBUF`, and `JSON_SR` converters.
- **Value Converter Schema ID Serializer**: The class name of the schema ID serializer for values. This is used to serialize schema IDs in the message headers.

**Auto-restart policy**

- **Enable Connector Auto-restart**: Enables the auto-restart behavior of the connector and its
  task in the event of user-actionable errors. Defaults to `true`, enabling the connector to
  automatically restart in case of user-actionable errors. Set this property to `false` to
  disable auto-restart for failed connectors. If disabled, you must manually restart the connector.

**Transforms**

- **Single Message Transformations**: To add a new SMT, see [Add transforms](../single-message-transforms.md#cc-single-message-transforms-ui).
  For more information about unsupported SMTs, see
  [Unsupported transformations](../single-message-transforms.md#cc-single-message-transforms-unsupported-transforms).

**Processing position**

- **Set offsets**: Click **Set offsets** to define a specific offset for
  this connector to begin procession data from. For more information
  on managing offsets, see [Manage offsets](../offsets.md#connect-custom-offsets).

See [Configuration Properties](#cc-couchbase-source-config-properties) for all property
values and definitions.

- Click **Continue**.

### Sizing

Based on the number of topic partitions you select, you will be provided
with a recommended number of tasks.

1. To change the number of recommended tasks, enter the number of
   [tasks](/platform/current/connect/concepts.html#tasks) for the connector to use
   in the **Tasks** field.
2. Click **Continue**.

### Review and Launch

1. Verify the connection details by previewing the running configuration.
2. After you’ve validated that the properties are configured to your
   satisfaction, click **Launch**.

   The status for the connector should go from **Provisioning** to
   **Running**.

#### Step 5: Check the Kafka topic

After the connector is running, verify that Couchbase documents are populating the
Kafka topic.

For more information and examples to use with the Confluent Cloud API for Connect,
see the [Confluent Cloud API for Connect Usage Examples](../connect-api-section.md#ccloud-connect-api) section.

### Using the Confluent CLI

Complete the following steps to set up and run the connector using the Confluent CLI.

#### NOTE
Make sure you have all your [prerequisites](#cc-couchbase-source-prereqs) completed.

#### Step 1: List the available connectors

Enter the following command to list available connectors:

```none
confluent connect plugin list
```

#### Step 2: List the connector configuration properties

Enter the following command to show the connector configuration properties:

```none
confluent connect plugin describe <connector-plugin-name>
```

The command output shows the required and optional configuration properties.

#### Step 3: Create the connector configuration file

Create a JSON file that contains the connector configuration properties. The
following example shows the required connector properties.

```json
 {
     "connector.class": "CouchbaseSource",
     "name": "<my-connector-name>",
     "kafka.auth.mode": "KAFKA_API_KEY",
     "kafka.api.key": "<my-kafka-api-key>",
     "kafka.api.secret": "<my-kafka-api-secret>",
     "couchbase.seed.nodes": "<couchbase-node-address>",
     "couchbase.bucket": "<bucket-name>",
     "couchbase.topic": "<topic>",
     "couchbase.username": "<database-username>",
     "couchbase.password": "<database-password>",
     "couchbase.source.handler": "com.couchbase.connect.kafka.handler.source.DefaultSchemaSourceHandler",
     "couchbase.batch.size.max": "2000",
     "output.data.format": "JSON",
     "tasks.max": "1",
     "auto.restart.on.user.error": "true"
}
```

Note the following property definitions:

* `"connector.class"`: Identifies the connector plugin name.
* `"name"`: Sets a name for your new connector.

* `"kafka.auth.mode"`: Identifies the connector authentication mode you want to use. There are two options: `SERVICE_ACCOUNT` or `KAFKA_API_KEY` (the default). To use an API key and secret, specify the configuration properties `kafka.api.key` and `kafka.api.secret`, as shown in the example configuration (above).  To use a [service account](../service-account.md#s3-cloud-service-account), specify the **Resource ID** in the property `kafka.service.account.id=<service-account-resource-ID>`. To list the available service account resource IDs, use the following command:
  ```bash
  confluent iam service-account list
  ```

  For example:
  ```bash
  confluent iam service-account list

     Id     | Resource ID |       Name        |    Description
  +---------+-------------+-------------------+-------------------
     123456 | sa-l1r23m   | sa-1              | Service account 1
     789101 | sa-l4d56p   | sa-2              | Service account 2
  ```

* `"couchbase.seed.nodes"`: A comma-separated addresses of Couchbase Server nodes.
  If a custom port is specified, it must be the KV port (which is normally `11210` for
  insecure connections, or `11207` for secure connections).
* `"couchbase.bucket"`: Name of the Couchbase bucket to use. This property is required
  unless using the experimental `AnalyticsSinkHandler`.
* `"couchbase.username"`: The name of the Couchbase user connecting to the Couchbase database.
* `"couchbase.password"`: The password of the Couchbase user connecting to the Couchbase database.
  This value may be overridden by the `KAFKA_COUCHBASE_PASSWORD` environment variable.
* `"couchbase.source.handler"`: The source handler determines how the Couchbase document is converted
  into a Kafka record. When using a custom source handler that filters out certain messages, consider
  also configuring `couchbase.black.hole.topic` property.

  #### NOTE
  - **Default data format for Kafka topics**: By default, the Couchbase source connector sends
    documents to Kafka topics as raw bytes.
  - **JSON format in Kafka topics**: To publish data in JSON format to Kafka topics, choose one of the following:
    * Set `output.data.format` to `BSON` and `couchbase.source.handler`
      to `com.couchbase.connect.kafka.handler.source.RawJsonSourceHandler`.
    * Set `output.data.format` to `JSON` and `couchbase.source.handler`
      to `com.couchbase.connect.kafka.handler.source.RawJsonSourceHandler`.
      Then, add the Couchbase DeserializeJson SMT to your configuration.
  - **Other Data Formats**: For all other combinations of `output.data.format` values and
    source handler configurations, data will be written to the Kafka topic in byte-array or
    base64 encoded format, depending on your configuration settings.
* `"couchbase.batch.size.max"`: Controls the maximum size of the batch for writing into a topic.
* `"output.data.format"`: Sets the output Kafka record value format (data
  coming from the connector). Valid entries are `AVRO`, `JSON_SR`,
  `PROTOBUF`, `JSON` or `BSON`. You must have Confluent Cloud Schema Registry
  configured if using a schema-based message format (for example, Avro, JSON_SR
  (JSON Schema), or Protobuf).

  #### NOTE
  When you set the output Kafka record value format to `JSON_SR`, `AVRO`, or `PROTOBUF`,
  only the metadata in the payload will have a schema; the Couchbase document itself will be schema-less.

  It chooses the appropriate converter and populates the derived settings `output.format.key` and `output.format.value` according to the table shown below.

  | `output.data.format`   | Converter           | `output.format.key`   | `output.format.value`   |
  |------------------------|---------------------|-----------------------|-------------------------|
  | `AVRO`                 | AvroConverter       | schema                | schema                  |
  | `JSON_SR`              | JsonSchemaConverter | schema                | schema                  |
  | `PROTOBUF`             | ProtobufConverter   | schema                | schema                  |
  | `JSON`                 | JsonConverter       | schema                | schema                  |
  | `BSON`                 | ByteArrayConverter  | bson                  | bson                    |

  If you select AVRO, be sure to set **Compatibility mode**
  (`schema.compatibility.level`) to `NONE` in Schema Registry. Note that schemas are
  generated per document in isolation. If not set to NONE, there is a chance
  that the new schema generated for the new document will not be backward
  compatible with previous versions of the schema.
* `"tasks.max"`: Enter the maximum number of
  [tasks](/platform/current/connect/index.html#tasks) for the connector to use. More
  tasks might improve performance.

**SMTs**: For details about adding SMTs using the Confluent CLI, see the [Single Message Transformations](../single-message-transforms.md#cc-single-message-transforms) documentation.

See [Configuration Properties](#cc-couchbase-source-config-properties) for all property values and
definitions.

#### Step 4: Load the properties file and create the connector

Enter the following command to load the configuration and start the connector:

```none
confluent connect cluster create --config-file <file-name>.json
```

For example:

```none
confluent connect cluster create --config-file couchbase-source.json
```

Example output:

```none
Created connector confluent-couchbase-source lcc-ix4dl
```

#### Step 5: Check the connector status

Enter the following command to check the connector status:

```none
confluent connect cluster list
```

Example output:

```none
ID          |            Name           | Status  | Type
+-----------+---------------------------+---------+-------+
lcc-ix4dl   | confluent-couchbase-source  | RUNNING | source
```

#### Step 6: Check the Kafka topic.

After the connector is running, verify that Couchbase documents are populating the
Kafka topic.

For more information and examples to use with the Confluent Cloud API for Connect,
see the [Confluent Cloud API for Connect Usage Examples](../connect-api-section.md#ccloud-connect-api) section.

<a id="cc-couchbase-source-config-properties"></a>

## Configuration Properties

Use the following configuration properties with the fully managed connector. For
self-managed connector property definitions and other details, see the connector
docs in [Self-managed connectors for Confluent Platform](/platform/current/connect/kafka_connectors.html).

### How should we connect to your data?

`name`
: Sets a name for your connector.
  <br/>
  * Type: string
  * Valid Values: A string at most 64 characters long
  * Importance: high

### Schema Config

`schema.context.name`
: Add a schema context name. A schema context represents an independent scope in Schema Registry. It is a separate sub-schema tied to topics in different Kafka clusters that share the same Schema Registry instance. If not used, the connector uses the default schema configured for Schema Registry in your Confluent Cloud environment.
  <br/>
  * Type: string
  * Default: default
  * Importance: medium

### Kafka Cluster credentials

`kafka.auth.mode`
: Kafka Authentication mode. It can be one of KAFKA_API_KEY or SERVICE_ACCOUNT. It defaults to KAFKA_API_KEY mode, whenever possible.
  <br/>
  * Type: string
  * Valid Values: SERVICE_ACCOUNT, KAFKA_API_KEY
  * Importance: high

`kafka.api.key`
: Kafka API Key. Required when kafka.auth.mode==KAFKA_API_KEY.
  <br/>
  * Type: password
  * Importance: high

`kafka.service.account.id`
: The Service Account that will be used to generate the API keys to communicate with Kafka Cluster.
  <br/>
  * Type: string
  * Importance: high

`kafka.api.secret`
: Secret associated with Kafka API key. Required when kafka.auth.mode==KAFKA_API_KEY.
  <br/>
  * Type: password
  * Importance: high

### Connection

`couchbase.seed.nodes`
: Addresses of Couchbase Server nodes, delimited by commas. If a custom port is specified, it must be the KV port (which is normally 11210 for insecure connections, or 11207 for secure connections).
  <br/>
  * Type: string
  * Importance: high

`couchbase.username`
: Name of the Couchbase user to authenticate as.
  <br/>
  * Type: string
  * Importance: high

`couchbase.password`
: Password of the Couchbase user.
  <br/>
  * Type: password
  * Importance: high

`couchbase.bucket`
: Name of the Couchbase bucket to use. This property is required unless using the experimental AnalyticsSinkHandler.
  <br/>
  * Type: string
  * Default: “”
  * Importance: high

### Source Behavior

`couchbase.topic`
: Name of the default Kafka topic to publish data to, for collections that don’t have an entry in the couchbase.collection.to.topic map. This is a format string that recognizes the following placeholders: ${bucket} refers to the bucket containing the document. ${scope} refers to the scope containing the document. ${collection} refers to the collection containing the document.
  <br/>
  * Type: string
  * Default: ${bucket}.${scope}.${collection}
  * Importance: medium

`couchbase.collection.to.topic`
: A map from Couchbase collection to Kafka topic. Collection and Topic are joined by an equals sign. Map entries are delimited by commas. For example, if you want to write messages from collection “scope-a.invoices” to topic “topic1”, and messages from collection “scope-a.widgets” to topic “topic2”, you would write: “scope-a.invoices=topic1,scope-a.widgets=topic2”. Defaults to an empty map. For collections not present in this map, the destination topic is determined by the couchbase.topic config property.
  <br/>
  * Type: string
  * Default: “”
  * Importance: medium

`couchbase.source.handler`
: The fully-qualified class name of the source handler to use. The source handler determines how the Couchbase document is converted into a Kafka record. To publish JSON messages identical to the Couchbase documents, use com.couchbase.connect.kafka.handler.source.RawJsonSourceHandler and set value.converter to org.apache.kafka.connect.converters.ByteArrayConverter. When using a custom source handler that filters out certain messages, consider also configuring couchbase.black.hole.topic. See that property’s documentation for details.
  <br/>
  * Type: string
  * Valid Values: com.couchbase.connect.kafka.handler.source.DefaultSchemaSourceHandler, com.couchbase.connect.kafka.handler.source.RawJsonSourceHandler, com.couchbase.connect.kafka.handler.source.RawJsonWithMetadataSourceHandler
  * Importance: medium

`couchbase.headers`
: Comma-delimited list of Couchbase metadata headers to add to records. Recognized values: bucket - Name of the bucket the document came from. scope - Name of the scope the document came from. collection - Name of the collection the document came from. key - The Couchbase document ID. qualifiedKey - The document’s scope, collection, and document ID, delimited by dots. Example: myScope.myCollection.myDocumentId cas - The document’s “compare and swap” value. partition - The index of the Couchbase partition the document came from. partitionUuid - Identifies the history branch of the partition the document came from. seqno - The DCP sequence number of the event. rev - The revision number of the event. expiry - The epoch second when the document expires, or null if the document has no expiry (or if the event is a deletion).
  <br/>
  * Type: list
  * Default: “”
  * Importance: medium

`couchbase.header.name.prefix`
: The connector prepends this value to header names to prevent collision with headers set by other parts of the system. For example, if couchbase.headers is set to bucket,qualifiedKey and header.name.prefix is set to example. then records will have headers named example.bucket and example.qualifiedKey.
  <br/>
  * Type: string
  * Default: couchbase.
  * Importance: medium

`couchbase.event.filter`
: The class name of the event filter to use. The event filter determines whether a database change event is ignored. As of version 4.2.4, the default filter ignores events from the Couchbase \_system scope. If you are interested in those events too, set this property to com.couchbase.connect.kafka.filter.AllPassIncludingSystemFilter. See also couchbase.black.hole.topic.
  <br/>
  * Type: string
  * Default: com.couchbase.connect.kafka.filter.AllPassFilter
  * Valid Values: com.couchbase.connect.kafka.filter.AllPassFilter, com.couchbase.connect.kafka.filter.AllPassIncludingSystemFilter
  * Importance: medium

`couchbase.black.hole.topic`
: If this property is non-blank, the connector publishes a tiny synthetic record to this topic whenever the Filter or SourceHandler ignores a source event. This lets the connector tell the Kafka Connect framework about the source offset of the ignored event. Configure this topic to use small segments and the lowest possible retention settings.
  <br/>
  * Type: string
  * Default: “”
  * Importance: medium

`couchbase.initial.offset.topic`
: If couchbase.stream.from is SAVED_OFFSET_OR_NOW, and this property is non-blank, on startup the connector publishes to the named topic one tiny synthetic record for each source partition that does not yet have a saved offset. This lets the connector initialize the missing source offsets to ‘now’ (the current state of Couchbase).
  <br/>
  * Type: string
  * Default: “”
  * Importance: medium

`couchbase.batch.size.max`
: Controls maximum size of the batch for writing into topic.
  <br/>
  * Type: int
  * Default: 2000
  * Importance: medium

`couchbase.stream.from`
: Controls when in the history the connector starts streaming from.
  <br/>
  * Type: string
  * Default: SAVED_OFFSET_OR_BEGINNING
  * Valid Values: BEGINNING, NOW, SAVED_OFFSET_OR_BEGINNING, SAVED_OFFSET_OR_NOW
  * Importance: medium

`couchbase.scope`
: If you wish to stream from all collections within a scope, specify the scope name here. Requires Couchbase Server 7.0 or later.
  <br/>
  * Type: string
  * Default: “”
  * Importance: medium

`couchbase.collections`
: If you wish to stream from specific collections, specify the qualified collection names here, separated by commas. A qualified name is the name of the scope followed by a dot (.) and then the name of the collection. For example: “tenant-foo.invoices”. If you specify neither “couchbase.scope” nor “couchbase.collections”, the connector will stream from all collections of all scopes in the bucket. Requires Couchbase Server 7.0 or later.
  <br/>
  * Type: string
  * Default: “”
  * Importance: medium

### Additional Configs

`header.converter`
: The converter class for the headers. This is used to serialize and deserialize the headers of the messages.
  <br/>
  * Type: string
  * Importance: low

`producer.override.compression.type`
: The compression type for all data generated by the producer. Valid values are none, gzip, snappy, lz4, and zstd.
  <br/>
  * Type: string
  * Importance: low

`producer.override.linger.ms`
: The producer groups together any records that arrive in between request transmissions into a single batched request. More details can be found in the documentation: [https://docs.confluent.io/platform/current/installation/configuration/producer-configs.html#linger-ms](https://docs.confluent.io/platform/current/installation/configuration/producer-configs.html#linger-ms).
  <br/>
  * Type: long
  * Valid Values: [100,…,1000]
  * Importance: low

`value.converter.allow.optional.map.keys`
: Allow optional string map key when converting from Connect Schema to Avro Schema. Applicable for Avro Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.auto.register.schemas`
: Specify if the Serializer should attempt to register the Schema.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.connect.meta.data`
: Allow the Connect converter to add its metadata to the output schema. Applicable for Avro Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.enhanced.avro.schema.support`
: Enable enhanced schema support to preserve package information and Enums. Applicable for Avro Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.enhanced.protobuf.schema.support`
: Enable enhanced schema support to preserve package information. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.flatten.unions`
: Whether to flatten unions (oneofs). Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.generate.index.for.unions`
: Whether to generate an index suffix for unions. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.generate.struct.for.nulls`
: Whether to generate a struct variable for null values. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.int.for.enums`
: Whether to represent enums as integers. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.latest.compatibility.strict`
: Verify latest subject version is backward compatible when use.latest.version is true.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.object.additional.properties`
: Whether to allow additional properties for object schemas. Applicable for JSON_SR Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.optional.for.nullables`
: Whether nullable fields should be specified with an optional label. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.optional.for.proto2`
: Whether proto2 optionals are supported. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.scrub.invalid.names`
: Whether to scrub invalid names by replacing invalid characters with valid characters. Applicable for Avro and Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.use.latest.version`
: Use latest version of schema in subject for serialization when auto.register.schemas is false.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.use.optional.for.nonrequired`
: Whether to set non-required properties to be optional. Applicable for JSON_SR Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.wrapper.for.nullables`
: Whether nullable fields should use primitive wrapper messages. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`value.converter.wrapper.for.raw.primitives`
: Whether a wrapper message should be interpreted as a raw primitive at root level. Applicable for Protobuf Converters.
  <br/>
  * Type: boolean
  * Importance: low

`errors.tolerance`
: Use this property if you would like to configure the connector’s error handling behavior. WARNING: This property should be used with CAUTION for SOURCE CONNECTORS as it may lead to dataloss. If you set this property to ‘all’, the connector will not fail on errant records, but will instead log them (and send to DLQ for Sink Connectors) and continue processing. If you set this property to ‘none’, the connector task will fail on errant records.
  <br/>
  * Type: string
  * Default: none
  * Importance: low

`key.converter.key.schema.id.serializer`
: The class name of the schema ID serializer for keys. This is used to serialize schema IDs in the message headers.
  <br/>
  * Type: string
  * Default: io.confluent.kafka.serializers.schema.id.PrefixSchemaIdSerializer
  * Importance: low

`key.converter.key.subject.name.strategy`
: How to construct the subject name for key schema registration.
  <br/>
  * Type: string
  * Default: TopicNameStrategy
  * Importance: low

`value.converter.decimal.format`
: Specify the JSON/JSON_SR serialization format for Connect DECIMAL logical type values with two allowed literals:
  <br/>
  BASE64 to serialize DECIMAL logical types as base64 encoded binary data and
  <br/>
  NUMERIC to serialize Connect DECIMAL logical type values in JSON/JSON_SR as a number representing the decimal value.
  <br/>
  * Type: string
  * Default: BASE64
  * Importance: low

`value.converter.flatten.singleton.unions`
: Whether to flatten singleton unions. Applicable for Avro and JSON_SR Converters.
  <br/>
  * Type: boolean
  * Default: false
  * Importance: low

`value.converter.ignore.default.for.nullables`
: When set to true, this property ensures that the corresponding record in Kafka is NULL, instead of showing the default column value. Applicable for AVRO,PROTOBUF and JSON_SR Converters.
  <br/>
  * Type: boolean
  * Default: false
  * Importance: low

`value.converter.reference.subject.name.strategy`
: Set the subject reference name strategy for value. Valid entries are DefaultReferenceSubjectNameStrategy or QualifiedReferenceSubjectNameStrategy. Note that the subject reference name strategy can be selected only for PROTOBUF format with the default strategy being DefaultReferenceSubjectNameStrategy.
  <br/>
  * Type: string
  * Default: DefaultReferenceSubjectNameStrategy
  * Importance: low

`value.converter.replace.null.with.default`
: Whether to replace fields that have a default value and that are null to the default value. When set to true, the default value is used, otherwise null is used. Applicable for JSON Converter.
  <br/>
  * Type: boolean
  * Default: true
  * Importance: low

`value.converter.schemas.enable`
: Include schemas within each of the serialized values. Input messages must contain schema and payload fields and may not contain additional fields. For plain JSON data, set this to false. Applicable for JSON Converter.
  <br/>
  * Type: boolean
  * Default: false
  * Importance: low

`value.converter.value.schema.id.serializer`
: The class name of the schema ID serializer for values. This is used to serialize schema IDs in the message headers.
  <br/>
  * Type: string
  * Default: io.confluent.kafka.serializers.schema.id.PrefixSchemaIdSerializer
  * Importance: low

`value.converter.value.subject.name.strategy`
: Determines how to construct the subject name under which the value schema is registered with Schema Registry.
  <br/>
  * Type: string
  * Default: TopicNameStrategy
  * Importance: low

### Number of tasks for this connector

`tasks.max`
: Maximum number of tasks for the connector.
  <br/>
  * Type: int
  * Valid Values: [1,…]
  * Importance: high

### Output messages

`output.data.format`
: Sets the output Kafka record value format. Valid entries are AVRO, JSON_SR, PROTOBUF, JSON, STRING or BSON. Note that you need to have Confluent Cloud Schema Registry configured if using a schema-based message format like AVRO, JSON_SR, and PROTOBUF
  <br/>
  * Type: string
  * Default: STRING
  * Importance: high

### Auto-restart policy

`auto.restart.on.user.error`
: Enable connector to automatically restart on user-actionable errors.
  <br/>
  * Type: boolean
  * Default: true
  * Importance: medium

## Frequently asked questions

Find answers to frequently asked questions about the Couchbase Source connector.

### Why does my connector fail with `Invalid schema type for ByteArrayConverter: STRUCT` error?

This error occurs when the source handler outputs structured records with schemas, while `ByteArrayConverter` is configured, which can only handle raw byte arrays or strings.

Common causes and solutions:

1. **Using DefaultSchemaSourceHandler with BSON**: When using `DefaultSchemaSourceHandler`, set `output.data.format` to `AVRO`, `JSON_SR`, or `PROTOBUF` instead of `BSON`. The `BSON` format uses `ByteArrayConverter`, which does not support structured data.
2. **Mismatched source handler and data format**: Use `RawJsonSourceHandler` or `RawJsonWithMetadataSourceHandler` if you need `BSON` output format. These handlers produce raw byte arrays compatible with `ByteArrayConverter`.

Valid source handler and output format combinations:

* **\`\`DefaultSchemaSourceHandler\`\`**: Use with `AVRO`, `JSON_SR`, `PROTOBUF`, or `JSON`
* **\`\`RawJsonSourceHandler\`\` or \`\`RawJsonWithMetadataSourceHandler\`\`**: Use with `BSON` or `JSON`

### Why does my connector fail with `Converting byte[] to Kafka Connect data failed` error?

This error occurs when using `RawJsonSourceHandler` or `RawJsonWithMetadataSourceHandler` with structured converters such as `AvroConverter`, `JsonSchemaConverter`, or `ProtobufConverter`.

These source handlers produce raw byte arrays rather than structured data with schemas. Structured converters cannot process raw byte arrays, which causes the serialization error.

Common causes and solutions:

1. **Using RawJson handlers with schema-based formats**: When using `RawJsonSourceHandler` or `RawJsonWithMetadataSourceHandler`, set `output.data.format` to `BSON` or `JSON`.
2. **Need for structured data**: If you need structured data with schemas, use `DefaultSchemaSourceHandler` with `output.data.format` set to `AVRO`, `JSON_SR`, or `PROTOBUF`.

For more information about source handlers and data formats, see [Configuration Properties](#cc-couchbase-source-config-properties).

### Why does my connector fail with connection timeout or TLS handshake errors?

Connection timeouts and TLS handshake failures occur when the connector cannot establish a secure connection to the Couchbase database.

Common causes and solutions:

1. **Incorrect seed nodes configuration**: Verify the `couchbase.seed.nodes` property uses the correct format. For secure connections, use `couchbases://` protocol. If specifying a custom port, use the KV port such as `11207` for secure connections or `11210` for insecure connections.
2. **Network connectivity issues**: Ensure the Couchbase database is reachable from Confluent Cloud. Check firewall rules, security groups, and network policies. For private Couchbase instances, ensure VPC peering or PrivateLink is configured.
3. **DNS resolution problems**: For PrivateLink deployments, ensure DNS records are configured correctly.

Check the connector logs in the Confluent Cloud Console for detailed error messages.

### Why is my connector stuck in `PROVISIONING` state?

If the connector remains in `PROVISIONING` state indefinitely without logs or errors, this indicates connectivity problems during the initial connection validation.

Common causes and solutions:

1. **Network timeouts**: The connector cannot reach the Couchbase database. During provisioning, the connector validates the connection. Network timeouts may cause the connector to hang.
2. **Firewall blocking**: Verify the Couchbase firewall or security groups allow inbound connections from Confluent Cloud egress IP addresses. For more information, see [Public Egress IP Addresses for Confluent Cloud Connectors](../static-egress-ip.md#cc-static-egress-ips).
3. **Incorrect authentication**: Verify the `couchbase.username` and `couchbase.password` credentials are correct and the user has permissions to access the specified bucket.
4. **Invalid bucket configuration**: Ensure the bucket specified in `couchbase.bucket` exists in the Couchbase database.

If the connector remains stuck after resolving connectivity issues, delete and recreate the connector with the corrected configuration.

### How do I route data to different Kafka topics based on document content?

By default, the connector creates topics using the naming convention `${bucket}.${scope}.${collection}`. To route data to different topics based on document content, use SMTs.

Routing options:

1. **ExtractTopic SMT**: Extract the topic name from a field in the document using `io.confluent.connect.transforms.ExtractTopic$Value`.
2. **RegexRouter SMT**: Route to different topics based on pattern matching using `org.apache.kafka.connect.transforms.RegexRouter`.
3. **Multiple SMTs**: Chain multiple SMTs to handle complex routing logic.

For more information about SMTs, see [Configure Single Message Transformations for Kafka Connectors in Confluent Cloud](../single-message-transforms.md#cc-single-message-transforms).

### How can I improve connector performance?

Performance optimization:

1. **Increase the number of tasks**: Set a higher `tasks.max` value to process more partitions in parallel. More tasks improve throughput.
2. **Tune batch size**: Increase `couchbase.batch.size.max` to consume more records in a single batch. Default is `2000`.
3. **Optimize polling interval**: Adjust `couchbase.persistence.polling.interval` to control how frequently the connector polls for changes. Lower values reduce latency but increase load.

Monitor connector metrics in the Confluent Cloud Console to identify bottlenecks.

### Why do I see duplicate records in Kafka topics?

The connector provides at-least-once delivery semantics by default.

Causes of duplicates:

1. **Transient failures**: When the connector experiences transient failures such as network issues or task rebalances, records may be replayed and published multiple times.
2. **Not routed to DLQ**: Duplicate records from replays are not considered errors and are not sent to the Dead Letter Queue.

Handling duplicates:

1. **Use idempotent consumers**: Design downstream consumers to handle duplicate records idempotently based on document IDs or other unique identifiers.
2. **Deduplicate in Kafka Streams**: Use Kafka Streams or ksqlDB to deduplicate records based on key or other fields.
3. **Enable exactly-once in consumers**: Configure consumer applications with `enable.idempotence=true` and appropriate transaction settings.

Monitor the connector’s lag and error rates to detect when replays occur.

## Next Steps

For an example that shows fully managed Confluent Cloud connectors in action with
Confluent Cloud for Apache Flink, see the [Cloud ETL Demo](/platform/current/tutorials/examples/cloud-etl/docs/index.html).
This example also shows how to use Confluent CLI to manage your resources in
Confluent Cloud.

[![image](images/topology.png)](https://docs.confluent.io/platform/current/tutorials/examples/cloud-etl/docs/index.html)
