// Module included in the following assemblies:
//
// assembly-config.adoc

[id='proc-manual-stop-pause-connector-{context}']
= Manually stopping or pausing Kafka Connect connectors

[role="_abstract"]
If you are using `KafkaConnector` resources to configure connectors, use the `state` configuration to either stop or pause a connector.
In contrast to the paused state, where the connector and tasks remain instantiated, stopping a connector retains only the configuration, with no active processes.
Stopping a connector from running may be more suitable for longer durations than just pausing.
While a paused connector is quicker to resume, a stopped connector has the advantages of freeing up memory and resources.

NOTE: The `state` configuration replaces the (deprecated) `pause` configuration in the `KafkaConnectorSpec` schema, which allows pauses on connectors. 
If you were previously using the `pause` configuration to pause connectors, we encourage you to transition to using the `state` configuration only to avoid conflicts.

.Prerequisites

* The Cluster Operator is running.

.Procedure

. Find the name of the `KafkaConnector` custom resource that controls the connector you want to pause or stop:
+
[source,shell,subs="+quotes"]
----
kubectl get KafkaConnector
----

. Edit the `KafkaConnector` resource to stop or pause the connector.
+
.Example configuration for stopping a Kafka Connect connector
[source,yaml,subs="attributes+"]
----
apiVersion: {KafkaConnectApiVersion}
kind: KafkaConnector
metadata:
  name: my-source-connector
  labels:
    strimzi.io/cluster: my-connect-cluster
spec:
  class: org.apache.kafka.connect.file.FileStreamSourceConnector
  tasksMax: 2
  config:
    file: "/opt/kafka/LICENSE"
    topic: my-topic
  state: stopped
  # ...
----
+
Change the `state` configuration to `stopped` or `paused`.
The default state for the connector when this property is not set is `running`.  

. Apply the changes to the `KafkaConnector` configuration.
+
You can resume the connector by changing `state` to `running` or removing the configuration.

NOTE: Alternatively, you can xref:con-exposing-kafka-connect-api-str[expose the Kafka Connect API] and use the `stop` and `pause` endpoints to stop a connector from running.
For example, `PUT /connectors/<connector_name>/stop`.
You can then use the `resume` endpoint to restart it. 