Exception: KubeMQ::StreamBrokenError

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

Overview

Note:

This error is retryable. Create a new sender or receiver after receiving this error.

Raised when a gRPC bidirectional stream breaks unexpectedly.

For queue upstream/downstream streams, the unacked_message_ids field lists messages that may not have been acknowledged before the break. Subscription streams auto-reconnect; sender/receiver streams must be recreated manually.

Instance Attribute Summary collapse

Attributes inherited from Error

#channel, #code, #details, #operation, #request_id, #suggestion

Instance Method Summary collapse

Methods inherited from Error

#cause, #retryable?, #to_s

Constructor Details

#initialize(message, unacked_message_ids: nil, **kwargs) ⇒ StreamBrokenError

Returns a new instance of StreamBrokenError.

Parameters:

  • message (String)

    error description

  • unacked_message_ids (Array<String>, nil) (defaults to: nil)

    IDs of in-flight messages

  • kwargs (Hash)

    additional options forwarded to Error#initialize



234
235
236
237
238
239
# File 'lib/kubemq/errors.rb', line 234

def initialize(message, unacked_message_ids: nil, **kwargs)
  kwargs[:code] ||= ErrorCode::STREAM_BROKEN
  kwargs[:retryable] = true unless kwargs.key?(:retryable)
  super(message, **kwargs)
  @unacked_message_ids = unacked_message_ids || []
end

Instance Attribute Details

#unacked_message_idsArray<String> (readonly)

Returns message IDs that were in-flight when the stream broke.

Returns:

  • (Array<String>)

    message IDs that were in-flight when the stream broke



229
230
231
# File 'lib/kubemq/errors.rb', line 229

def unacked_message_ids
  @unacked_message_ids
end