KubeMQ
Client SDKsRubyReference

Types & Errors

KubeMQ Ruby SDK shared types, error hierarchy, and configuration classes.

Error Hierarchy

All SDK errors inherit from KubeMQ::Error, which extends StandardError. Each error carries structured context for targeted recovery.

KubeMQ::Error
├── KubeMQ::ConnectionError
│   └── KubeMQ::AuthenticationError
├── KubeMQ::TimeoutError
├── KubeMQ::ValidationError
├── KubeMQ::ConfigurationError
├── KubeMQ::ChannelError
├── KubeMQ::MessageError
├── KubeMQ::TransactionError
├── KubeMQ::ClientClosedError
├── KubeMQ::ConnectionNotReadyError
├── KubeMQ::StreamBrokenError
├── KubeMQ::BufferFullError
└── KubeMQ::CancellationError

KubeMQ::Error

Base exception class with structured context.

AttributeTypeDescription
codeStringSDK error code
detailsHashAdditional error context
operationStringThe operation that failed
channelStringChannel name involved
request_idStringRequest ID for correlation
suggestionStringActionable suggestion for resolution
retryable?BooleanWhether the operation may succeed on retry
causeExceptionOriginal exception that triggered this error
begin
  client.send_event(msg)
rescue KubeMQ::TimeoutError => e
  retry if e.retryable?
rescue KubeMQ::ValidationError => e
  puts "#{e.message}#{e.suggestion}"
rescue KubeMQ::Error => e
  puts "#{e.class}: #{e.message} (code=#{e.code})"
end

Error Types

Error ClassRetryableDescription
ConnectionErrorVariesgRPC connection failed or lost
AuthenticationErrorNoInvalid or expired auth token
TimeoutErrorYesOperation exceeded deadline
ValidationErrorNoInvalid request parameters
ConfigurationErrorNoInvalid client configuration
ChannelErrorVariesChannel operation failed at broker
MessageErrorVariesMessage send/receive failed
TransactionErrorVariesQueue ack/nack/requeue failed
ClientClosedErrorNoOperation on a closed client
ConnectionNotReadyErrorNoTransport not yet connected
StreamBrokenErrorYesgRPC bidirectional stream broke
BufferFullErrorNoReconnect message buffer at capacity
CancellationErrorNoOperation cancelled via CancellationToken

CancellationToken

Cooperative cancellation for subscriptions and long-running operations.

token = KubeMQ::CancellationToken.new

client.subscribe_to_events(sub, cancellation_token: token) do |event|
  puts event.body
end

token.cancel
token.cancelled? # => true
MethodDescription
cancelSignal cancellation
cancelled?Check if cancelled
waitBlock until cancelled

ServerInfo

Returned from client.ping.

AttributeTypeDescription
hostStringBroker hostname
versionStringBroker version
server_up_time_secondsIntegerServer uptime in seconds

ChannelInfo

Returned from client.list_channels.

AttributeTypeDescription
nameStringChannel name
typeStringChannel type
active?BooleanWhether the channel has active connections

Configuration Classes

TLSConfig

tls = KubeMQ::TLSConfig.new(
  enabled: true,
  cert_file: "/certs/client.pem",
  key_file: "/certs/client-key.pem",
  ca_file: "/certs/ca.pem",
  insecure_skip_verify: false
)

KeepAliveConfig

keepalive = KubeMQ::KeepAliveConfig.new(
  enabled: true,
  ping_interval_seconds: 10,
  ping_timeout_seconds: 5,
  permit_without_calls: true
)

ReconnectPolicy

policy = KubeMQ::ReconnectPolicy.new(
  enabled: true,
  base_interval: 1.0,
  multiplier: 2.0,
  max_delay: 30.0,
  jitter_percent: 0.25,
  max_attempts: 0
)

ChannelType Constants

ConstantDescription
KubeMQ::ChannelType::EVENTSEvents channels
KubeMQ::ChannelType::EVENTS_STOREEvents store channels
KubeMQ::ChannelType::QUEUESQueue channels
KubeMQ::ChannelType::COMMANDSCommand channels
KubeMQ::ChannelType::QUERIESQuery channels

Was this page helpful?

On this page