Sha256: 464e0c112fd3ff7d4adb682f7568ba12c2663e3f0c88b30c4e40e9b2a184311b

Contents?: true

Size: 761 Bytes

Versions: 8

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Controllers
    # Feature that allows us to use responders flow in controller
    module Responders
      # Responds with given data using given responder. This allows us to have a similar way of
      # defining flows like synchronous protocols
      # @param data Anything we want to pass to responder based on which we want to trigger further
      #   Kafka responding
      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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
karafka-1.1.2 lib/karafka/controllers/responders.rb
karafka-1.1.1 lib/karafka/controllers/responders.rb
karafka-1.1.0 lib/karafka/controllers/responders.rb
karafka-1.1.0.alpha2 lib/karafka/controllers/responders.rb
karafka-1.1.0.alpha1 lib/karafka/controllers/responders.rb
karafka-1.0.1 lib/karafka/controllers/responders.rb
karafka-1.0.0 lib/karafka/controllers/responders.rb
karafka-1.0.0.rc1 lib/karafka/controllers/responders.rb