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, scale_delay: 60_000) ⇒ 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

  • scale_delay (Integer) (defaults to: 60_000)

    number of ms of delay before applying any scale operation to a consumer group



19
20
21
22
23
24
25
26
27
# File 'lib/karafka/pro/routing/features/multiplexing/proxy.rb', line 19

def multiplexing(min: nil, max: 1, boot: nil, scale_delay: 60_000)
  @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,
    multiplexing_scale_delay: scale_delay
  )
end