Class: KubeMQ::KeepAliveConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/kubemq/configuration.rb

Overview

gRPC keepalive configuration for long-lived connections.

When enabled (default), periodic pings are sent to detect dead connections and keep firewalls/load-balancers from closing idle connections.

Examples:

Aggressive keepalive for flaky networks

keepalive = KubeMQ::KeepAliveConfig.new(
  ping_interval_seconds: 5,
  ping_timeout_seconds: 3
)

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled: true, ping_interval_seconds: 10, ping_timeout_seconds: 5, permit_without_calls: true) ⇒ KeepAliveConfig

Creates a new keepalive configuration.

Parameters:

  • enabled (Boolean) (defaults to: true) —

    whether gRPC keepalive is enabled (default: true)

  • ping_interval_seconds (Integer) (defaults to: 10) —

    seconds between keepalive pings (default: 10)

  • ping_timeout_seconds (Integer) (defaults to: 5) —

    seconds to wait for a ping response (default: 5)

  • permit_without_calls (Boolean) (defaults to: true) —

    send pings without active RPCs (default: true)



80
81
82
83
84
85
86
# File 'lib/kubemq/configuration.rb', line 80

def initialize(enabled: true, ping_interval_seconds: 10, ping_timeout_seconds: 5,
               permit_without_calls: true)
  @enabled = enabled
  @ping_interval_seconds = Integer(ping_interval_seconds)
  @ping_timeout_seconds = Integer(ping_timeout_seconds)
  @permit_without_calls = permit_without_calls
end

Instance Attribute Details

#enabled ⇒ Boolean

Returns whether gRPC keepalive is enabled (default: true).

Returns:

  • (Boolean) —

    whether gRPC keepalive is enabled (default: true)



72
73
74
# File 'lib/kubemq/configuration.rb', line 72

def enabled
  @enabled
end

#permit_without_calls ⇒ Boolean

Returns send pings even when there are no active RPCs (default: true).

Returns:

  • (Boolean) —

    send pings even when there are no active RPCs (default: true)



72
# File 'lib/kubemq/configuration.rb', line 72

attr_accessor :enabled, :ping_interval_seconds, :ping_timeout_seconds, :permit_without_calls

#ping_interval_seconds ⇒ Integer

Returns seconds between keepalive pings (default: 10).

Returns:

  • (Integer) —

    seconds between keepalive pings (default: 10)



72
# File 'lib/kubemq/configuration.rb', line 72

attr_accessor :enabled, :ping_interval_seconds, :ping_timeout_seconds, :permit_without_calls

#ping_timeout_seconds ⇒ Integer

Returns seconds to wait for a ping response before considering the connection dead (default: 5).

Returns:

  • (Integer) —

    seconds to wait for a ping response before considering the connection dead (default: 5)



72
# File 'lib/kubemq/configuration.rb', line 72

attr_accessor :enabled, :ping_interval_seconds, :ping_timeout_seconds, :permit_without_calls