> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streamnative.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Protocols

This topic describes how to enable, disable, and configure different messaging and data streaming protocols for your cluster. For general guidance on configuring your cluster, see [Cluster Configuration Overview](/cloud/clusters/configure-clusters/cluster-configuration-overview).

The following protocols are available for configuration:

1. [Kafka Protocol](#kafka-protocol)
2. [AMQP (Advanced Message Queuing Protocol)](#amqp-advanced-message-queuing-protocol)
3. [MQTT (Message Queuing Telemetry Transport)](#mqtt-message-queuing-telemetry-transport)
4. [WebSocket](#websocket)

Making changes to the protocols configuration results in restarting the Pulsar brokers in your cluster. Please plan these changes accordingly to avoid disruption to your business applications.

### Kafka Protocol

Kafka protocol support allows Kafka clients to interact with your Pulsar cluster. This enables seamless integration for applications already using Kafka.

To enable and configure the Kafka protocol for your Pulsar cluster, you can use the `config` section in your PulsarCluster specification. Here's how to do it:

1. In your PulsarCluster specification, locate or add the `config` section.
2. Within the `config` section, add a `protocols` field.
3. In the `protocols` field, add a `kafka` object to configure Kafka-specific settings.

Here's how you can configure Kafka protocol support:

1. Using `snctl`:

   ```yaml theme={null}
   apiVersion: cloud.streamnative.io/v1alpha1
   kind: PulsarCluster
   metadata:
     name: my-cluster
   spec:
     config:
       protocols:
         kafka: {}
   ```

2. Using Terraform:

   ```hcl theme={null}
   resource "streamnative_cluster" "my_cluster" {
     # ... other configuration ...

     config {
       protocols {
         kafka = {
           enabled = "true"
         }
       }
     }
   }
   ```

**Important:** If you try to disable the Kafka protocol in your cluster after you have enabled it, you will disrupt the existing Kafka clients connected to your cluster and cause data corruption.

### AMQP (Advanced Message Queuing Protocol)

<Note title="Note">
  AMQP protocol support is currently in Private Preview and is only available to select users. If you're interested in trying out this feature, please contact StreamNative support for more information.
</Note>

AMQP support allows AMQP-compliant clients to connect to your Pulsar cluster. This is useful for applications that require AMQP compatibility.

To enable and configure the AMQP protocol for your Pulsar cluster, you can use the `config` section in your PulsarCluster specification. Here's how to do it:

1. In your PulsarCluster specification, locate or add the `config` section.
2. Within the `config` section, add a `protocols` field.
3. In the `protocols` field, add a `amqp` object to configure AMQP-specific settings.

Here's how you can configure AMQP protocol support:

1. Using `snctl`:

   ```yaml theme={null}
   apiVersion: cloud.streamnative.io/v1alpha1
   kind: PulsarCluster
   metadata:
     name: my-cluster
   spec:
     config:
       protocols:
         amqp: {}
   ```

2. Using Terraform:

   ```hcl theme={null}
   resource "streamnative_cluster" "my_cluster" {
     # ... other configuration ...

     config {
       protocols {
         amqp = {
           enabled = "true"
         }
       }
     }
   }
   ```

**Important:** If you try to disable the AMQP protocol in your cluster after you have enabled it, you will disrupt the existing AMQP clients connected to your cluster and cause data corruption.

### MQTT (Message Queuing Telemetry Transport)

MQTT support enables IoT devices and applications using the MQTT protocol to communicate with your Pulsar cluster. This is particularly useful for IoT and mobile scenarios.

To enable and configure the MQTT protocol for your Pulsar cluster, you can use the `config` section in your PulsarCluster specification. Here's how to do it:

1. In your PulsarCluster specification, locate or add the `config` section.
2. Within the `config` section, add a `protocols` field.
3. In the `protocols` field, add a `mqtt` object to configure MQTT-specific settings.

Here's how you can configure MQTT protocol support:

1. Using `snctl`:

   ```yaml theme={null}
   apiVersion: cloud.streamnative.io/v1alpha1
   kind: PulsarCluster
   metadata:
     name: my-cluster
   spec:
     config:
       protocols:
         mqtt: {}
   ```

2. Using Terraform:

   ```hcl theme={null}
   resource "streamnative_cluster" "my_cluster" {
     # ... other configuration ...

     config {
       protocols {
         mqtt = {
           enabled = "true"
         }
       }
     }
   }
   ```

**Important:** If you try to disable the MQTT protocol in your cluster after you have enabled it, you will disrupt the existing MQTT clients connected to your cluster and cause data corruption.

### WebSocket

[Pulsar WebSocket](https://pulsar.apache.org/docs/3.3.x/client-libraries-websocket/) support enables real-time, bidirectional communication between clients and your Pulsar cluster via WebSocket. This feature can be enabled or disabled based on your requirements.

To enable WebSocket for your cluster, you can set the `config.websocketEnabled` field in your PulsarCluster specification to `true` if you are using `snctl` or `config.websocket_enabled` field in your PulsarCluster specification to `true` if you are using Terraform.

Please note that if you disable WebSocket, you will not be able to create new WebSocket clients in the cluster. Existing WebSocket clients will be disconnected.
