Class: KubeMQ::CQ::QueryReceived

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

Overview

A query received by a subscriber via KubeMQ::CQClient#subscribe_to_queries.

After processing, use the #reply_channel and #id to construct a QueryResponseMessage and send it back via KubeMQ::CQClient#send_response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, channel:, metadata:, body:, reply_channel:, tags:, timeout: 0, client_id: nil, **_) ⇒ QueryReceived

Returns a new instance of QueryReceived.

Parameters:

  • id (String) —

    request identifier

  • channel (String) —

    source channel name

  • metadata (String) —

    query metadata

  • body (String) —

    query payload

  • reply_channel (String) —

    response channel

  • tags (Hash{String => String}, nil) —

    key-value tags

  • timeout (Integer) (defaults to: 0) —

    sender timeout in milliseconds (default: 0)

  • client_id (String, nil) (defaults to: nil) —

    sender's client ID



40
41
42
43
44
45
46
47
48
49
# File 'lib/kubemq/cq/query_received.rb', line 40

def initialize(id:, channel:, metadata:, body:, reply_channel:, tags:, timeout: 0, client_id: nil, **_)
  @id = id
  @channel = channel
   = 
  @body = body
  @reply_channel = reply_channel
  @tags = tags || {}
  @timeout = timeout
  @client_id = client_id
end

Instance Attribute Details

#body ⇒ String (readonly)

Returns query payload (binary).

Returns:

  • (String) —

    query payload (binary)



30
# File 'lib/kubemq/cq/query_received.rb', line 30

attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id

#channel ⇒ String (readonly)

Returns the channel the query was sent to.

Returns:

  • (String) —

    the channel the query was sent to



30
# File 'lib/kubemq/cq/query_received.rb', line 30

attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id

#client_id ⇒ Object (readonly)

Returns the value of attribute client_id.



30
# File 'lib/kubemq/cq/query_received.rb', line 30

attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id

#id ⇒ String (readonly)

Returns request identifier (use as request_id in the response).

Returns:

  • (String) —

    request identifier (use as request_id in the response)



30
31
32
# File 'lib/kubemq/cq/query_received.rb', line 30

def id
  @id
end

#metadata ⇒ String (readonly)

Returns query metadata.

Returns:

  • (String) —

    query metadata



30
# File 'lib/kubemq/cq/query_received.rb', line 30

attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id

#reply_channel ⇒ String (readonly)

Returns channel to send the response back on.

Returns:

  • (String) —

    channel to send the response back on



30
# File 'lib/kubemq/cq/query_received.rb', line 30

attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id

#tags ⇒ Hash{String => String} (readonly)

Returns user-defined key-value tags.

Returns:

  • (Hash{String => String}) —

    user-defined key-value tags



30
# File 'lib/kubemq/cq/query_received.rb', line 30

attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id

#timeout ⇒ Integer (readonly)

Returns original timeout from the sender (milliseconds).

Returns:

  • (Integer) —

    original timeout from the sender (milliseconds)



30
# File 'lib/kubemq/cq/query_received.rb', line 30

attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id