Class: RSMP::AckCollector

Inherits:
Collector show all
Defined in:
lib/rsmp/collect/ack_collector.rb

Overview

Class for waiting for a message acknowledgement

Instance Attribute Summary

Attributes inherited from Collector

#condition, #error, #messages, #status, #task

Instance Method Summary collapse

Methods inherited from Collector

#cancel, #cancelled?, #collect, #collect!, #collecting?, #complete, #describe, #describe_num_and_type, #describe_progress, #describe_query, #describe_types, #do_stop, #done?, #identifier, #incomplete, #ingoing?, #inspect, #keep, #log_complete, #log_incomplete, #log_start, #notify, #notify_disconnect, #notify_error, #notify_schema_error, #ok!, #ok?, #outgoing?, #perform_match, #ready?, #reject_not_ack, #reset, #start, #timeout?, #use_task, #wait, #wait!

Methods inherited from Listener

#change_notifier, #notify, #notify_error

Methods included from Inspect

#inspect, #inspector

Constructor Details

#initialize(proxy, options = {}) ⇒ AckCollector

Returns a new instance of AckCollector.

Raises:

  • (ArgumentError)


4
5
6
7
8
# File 'lib/rsmp/collect/ack_collector.rb', line 4

def initialize proxy, options={}
  raise ArgumentError.new("m_id must be provided") unless options[:m_id]
  required = { type: 'MessageAck', num: 1, title: 'message acknowledgement' }
  super proxy, options.merge(required)
end

Instance Method Details

#type_match?(message) ⇒ Boolean

Check if we the MessageAck related to initiating request, identified by @m_id.

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/rsmp/collect/ack_collector.rb', line 11

def type_match? message
  return false if super(message) == false
  return message.attribute('oMId') == @options[:m_id]
end