lib/karafka/base_worker.rb in karafka-sidekiq-backend-1.0.0 vs lib/karafka/base_worker.rb in karafka-sidekiq-backend-1.1.0.alpha1

- old
+ new

@@ -8,10 +8,12 @@ # Executes the logic that lies in #perform Karafka controller method # @param topic_id [String] Unique topic id that we will use to find a proper topic # @param params_batch [Array] Array with messages batch def perform(topic_id, params_batch) Karafka.monitor.notice(self.class, params_batch) - controller(topic_id, params_batch).perform + instance = controller(topic_id, params_batch) + # This allows to support both Karafka 1.0 and 1.1 + instance.respond_to?(:consume) ? instance.consume : instance.perform end private # @return [Karafka::Controller] descendant of Karafka::BaseController that matches the topic