# How to handle kafka RetriableCommitFailedException when using committableSource?

**URL:** <https://discuss.akka.io/t/how-to-handle-kafka-retriablecommitfailedexception-when-using-committablesource/1683>\
**Category:** Akka Streams & Alpakka\
**Tags:** scala\
**Created:** [July 25, 2018, 3:55pm UTC](https://discuss.akka.io/t/how-to-handle-kafka-retriablecommitfailedexception-when-using-committablesource/1683 "2018-07-25T15:55:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lawulu](https://avatars.discourse-cdn.com/v4/letter/l/e36b37/32.png) [@lawulu](https://discuss.akka.io/u/lawulu)\
**Post date:** [July 25, 2018, 3:55pm UTC](https://discuss.akka.io/t/how-to-handle-kafka-retriablecommitfailedexception-when-using-committablesource/1683/1 "2018-07-25T15:55:37Z")

</div>

We are using alpakka to consumer the Kafka messages, but we offen meet the RetriableCommitFailedException which make the consumer stops

Sample code:

```auto
Consumer.committableSource(consumerSettings, Subscriptions.topics(topic))
      .mapAsync(1) { msg =>

       handle(msg)
      }
      .batch(max = 20, first => CommittableOffsetBatch.empty.updated(first)) { (batch, elem) =>
        batch.updated(elem)
      }
      .mapAsync(3)(commitBatch(_))
      .runWith(Sink.ignore)

```

Excepiton:

```auto
org.apache.kafka.clients.consumer.RetriableCommitFailedException: Offset commit failed with a retriable exception. You should retry committing the latest consumed offsets.

```

I know I should re-commit the offsets, but I am new for akka streams, I dont know how to do it.

---

<div class="post-metadata">

**Author:** ![bvinayakumar](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvinayakumar](https://discuss.akka.io/u/bvinayakumar)\
**Post date:** [September 21, 2020, 4:17am UTC](https://discuss.akka.io/t/how-to-handle-kafka-retriablecommitfailedexception-when-using-committablesource/1683/2 "2020-09-21T04:17:51Z")

</div>

I am also facing same exception. Any suggestion(s)?

```auto
2020-09-20 21:54:23.583 [kafka-coordinator-heartbeat-thread | ceon-current-local-read] ERROR o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-1, groupId=ceon-current-local-read] Offset commit failed on partition ceon-cds-sync-event0-0 at offset 0: This is not the correct coordinator.
2020-09-20 21:54:24.172 [ceon-current-data-akka.actor.default-dispatcher-20] WARN a.kafka.internal.KafkaConsumerActor - Kafka commit took longer than `commit-time-warning`: 3039 ms
2020-09-20 21:54:24.188 [ceon-current-data-akka.actor.default-dispatcher-21] ERROR o.d.c.s.current.actors.KafkaConsumer - Exception in stream processing
org.apache.kafka.clients.consumer.RetriableCommitFailedException: Offset commit failed with a retriable exception. You should retry committing the latest consumed offsets.
Caused by: org.apache.kafka.common.errors.DisconnectException: null

```

---

<div class="post-metadata">

**Author:** ![seglo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/seglo/32/1767_2.png) [@seglo](https://discuss.akka.io/u/seglo)\
**Post date:** [September 21, 2020, 2:34pm UTC](https://discuss.akka.io/t/how-to-handle-kafka-retriablecommitfailedexception-when-using-committablesource/1683/3 "2020-09-21T14:34:58Z")

</div>

Hi @bvinayakumar. Alpakka Kafka recently added support to retry retriable commit failures. It is available in Alpakka Kafka 2.0.2 and greater. Are you using a recent version?

> <https://github.com/akka/alpakka-kafka/pull/1111>
