From 05377b0256cfe92cffeb9df6cf65036fa6423266 Mon Sep 17 00:00:00 2001 From: Maciej Mensfeld Date: Thu, 6 Aug 2026 11:22:04 +0200 Subject: [PATCH 1/2] migrate declaratives format --- v2.6-rails/karafka.rb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/v2.6-rails/karafka.rb b/v2.6-rails/karafka.rb index d58e4e22..2de3ccfb 100644 --- a/v2.6-rails/karafka.rb +++ b/v2.6-rails/karafka.rb @@ -35,15 +35,26 @@ class KarafkaApp < Karafka::App ) ) - routes.draw do - # This needs to match queues defined in your ActiveJobs - active_job_topic :default do + # Declarative topics configuration. This is independent from routing and + # describes the desired Kafka infrastructure (partitions, replication and + # topic-level settings) for topics managed by this application. + declaratives.draw do + topic :default do + partitions 5 # Expire jobs after 1 day - config(partitions: 5, 'retention.ms': 86_400_000) + config('retention.ms': 86_400_000) + end + + topic :visits do + partitions 3 end + end + + routes.draw do + # This needs to match queues defined in your ActiveJobs + active_job_topic :default topic :visits do - config(partitions: 2) consumer VisitsConsumer end end From 2787a8b1b8c7537b3785eaceca93558a14f4e13a Mon Sep 17 00:00:00 2001 From: Maciej Mensfeld Date: Thu, 6 Aug 2026 11:22:56 +0200 Subject: [PATCH 2/2] dont overprovision visits --- v2.6-rails/karafka.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2.6-rails/karafka.rb b/v2.6-rails/karafka.rb index 2de3ccfb..1e4b89a6 100644 --- a/v2.6-rails/karafka.rb +++ b/v2.6-rails/karafka.rb @@ -46,7 +46,7 @@ class KarafkaApp < Karafka::App end topic :visits do - partitions 3 + partitions 2 end end