Module: Karafka::Controllers::Responders

Defined in:
lib/karafka/controllers/responders.rb

Overview

Feature that allows us to use responders flow in controller

Instance Method Summary collapse

Instance Method Details

#respond_with(*data) ⇒ Object

Responds with given data using given responder. This allows us to have a similar way of defining flows like synchronous protocols

Parameters:

  • data

    Anything we want to pass to responder based on which we want to trigger further Kafka responding



11
12
13
14
15
16
# File 'lib/karafka/controllers/responders.rb', line 11

def respond_with(*data)
  Karafka.monitor.notice(self.class, data: data)
  # @note we build a new instance of responder each time, as a long running (persisted)
  #   controllers can respond multiple times during the lifecycle
  topic.responder.new(topic.parser).call(*data)
end