Migrate to Kafka 4.0

Proprietary

Migrate applications to the latest Kafka 4.0 release. This includes updating dependencies to 4.0.x and migrating the APIs and configuration that Kafka 4.0 removed. Kafka 4.0 clients and Kafka Streams require Java 11, and its other artifacts Java 17; upgrading Java is left to org.openrewrite.java.migrate recipes.

io.moderne.kafka.MigrateToKafka40
mod run . --recipe=io.moderne.kafka.MigrateToKafka40

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Migrate to Kafka 3.3
  2. Use the Scala 2.13 builds of Kafka
  3. Upgrade Gradle or Maven dependency versions org.apache.kafka:*:4.0.x
  4. Remove deprecated Kafka property log.message.format.version
  5. Remove deprecated Kafka property message.format.version
  6. Remove deprecated Kafka property inter.broker.protocol.version
  7. Delete property by key log.message.format.version
  8. Delete property by key message.format.version
  9. Delete property by key inter.broker.protocol.version
  10. Add comment before property key
  11. Add comment before property key
  12. Add comment before property key
  13. Add comment before property key
  14. Migrate deprecated sendOffsetsToTransaction to use ConsumerGroupMetadata
  15. Migrate Consumer.poll(long) to poll(Duration)
  16. Migrate Consumer.committed(TopicPartition) to committed(Set<TopicPartition>)
  17. Migrate ConsumerRecord constructors removed in Kafka 4.0
  18. Migrate MockProducer constructors removed in Kafka 4.0
  19. Migrate ConsumerGroupState to GroupState
  20. Migrate AdminClient.alterConfigs() to incrementalAlterConfigs()
  21. Change method name org.apache.kafka.clients.admin.DescribeTopicsResult values() to topicNameValues
  22. Delete method argument 4 in methods org.apache.kafka.clients.producer.RecordMetadata <constructor>(org.apache.kafka.common.TopicPartition, long, long, long, Long, int, int)
  23. Migrate client and Admin APIs removed in Kafka 4.0
  24. Migrate Kafka Streams APIs removed in Kafka 4.0
  25. Migrate broker and client configuration removed in Kafka 4.0
  26. Migrate MirrorMaker 2 configuration removed in Kafka 4.0