Module: Karafka::Pro::Routing::Features::Multiplexing::Proxy

Defined in:
lib/karafka/pro/routing/features/multiplexing/proxy.rb

Overview

Allows for multiplexing setup inside a consumer group definition

Instance Method Summary collapse

Instance Method Details

#multiplexing(min: nil, max: 1, boot: nil) ⇒ Object

Parameters:

  • min (Integer, nil) (defaults to: nil)

    min multiplexing count or nil to set it to max, effectively disabling dynamic multiplexing

  • max (Integer) (defaults to: 1)

    max multiplexing count

  • boot (Integer) (defaults to: nil)

    how many listeners should we start during boot by default



25
26
27
28
29
30
31
32
# File 'lib/karafka/pro/routing/features/multiplexing/proxy.rb', line 25

def multiplexing(min: nil, max: 1, boot: nil)
  @target.current_subscription_group_details.merge!(
    multiplexing_min: min || max,
    multiplexing_max: max,
    # Picks half of max by default as long as possible. Otherwise goes with min
    multiplexing_boot: boot || [min || max, (max / 2)].max
  )
end