diff --git a/v2.6-rails/karafka.rb b/v2.6-rails/karafka.rb index d58e4e2..1e4b89a 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 2 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