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

[id='proc-resetting-connector-offsets-{context}']
= Resetting connector offsets

[role="_abstract"]
To reset connector offsets using `KafkaConnector` resources, configure the resource to stop the connector. 

After the connector is stopped, annotate the `KafkaConnector` resource to clear the offsets, then restart the connector.

In this procedure, we reset the offset position for a source connector named `my-source-connector`.

.Prerequisites

* The Cluster Operator is running.

.Procedure

. Edit the `KafkaConnector` resource to stop the connector.
+
.Example configuration to stop a connector
[source,yaml,subs="+attributes"]
----
apiVersion: {KafkaConnectorApiVersion}
kind: KafkaConnector
metadata:
  name: my-source-connector
  labels:
    strimzi.io/cluster: my-connect-cluster
spec:
  # ...
  state: stopped # <1>
  # ... 
----
<1> Changes the state of the connector to `stopped`. The default state for the connector when this property is not set is `running`.

. Run the command to reset the offset position by annotating the `KafkaConnector` resource:
+
[source,shell]
----
kubectl annotate kafkaconnector my-source-connector strimzi.io/connector-offsets=reset -n <namespace>
----
+
The annotation remains until either the reset operation succeeds or it is manually removed from the resource.

. Check the changes by using the procedure to xref:proc-listing-connector-offsets-{context}[list connector offsets].
+
After resetting, the `offsets.json` property is empty. 
+
.Example source connector offset list
[source,yaml,subs="+attributes"]
----
apiVersion: v1
kind: ConfigMap
metadata:
  # ...
data: 
  offsets.json: |-
    {
      "offsets" : []
    } 
----

. Restart the connector by changing the state to `running`.
+
.Example configuration to start a connector
[source,yaml,subs="+attributes"]
----
apiVersion: {KafkaConnectorApiVersion}
kind: KafkaConnector
metadata:
  name: my-source-connector
  labels:
    strimzi.io/cluster: my-connect-cluster
spec:
  state: running
  # ... 
----