Class: ASIR::Transport::Broadcast

Inherits:
ASIR::Transport show all
Includes:
Composite
Defined in:
lib/asir/transport/broadcast.rb

Overview

!SLIDE Broadcast Transport

Broadcast to multiple Transports.

Constant Summary

Constants included from ASIR::ThreadVariable

ASIR::ThreadVariable::DEBUG, ASIR::ThreadVariable::EMPTY_HASH, ASIR::ThreadVariable::SETTER

Instance Attribute Summary

Attributes included from Composite

#continue_on_exception, #transports

Attributes included from Delegation

#on_failed_message, #on_send_message_exception, #reraise_first_exception

Attributes inherited from ASIR::Transport

#after_invoke_message, #after_receive_message, #before_send_message, #coder_needs_result_message, #decoder, #encoder, #invoker, #message_count, #needs_message_identifier, #needs_message_timestamp, #on_exception, #on_result_exception, #one_way, #running, #verbose

Attributes included from Log

#_logger

Instance Method Summary collapse

Methods included from Delegation

#_handle_send_message_exception!, #_receive_result, #needs_message_identifier?, #needs_message_timestamp?, #transports

Methods inherited from ASIR::Transport

#_subclass_responsibility, #initialize, #invoke_message!, #needs_message_identifier?, #needs_message_timestamp?, #receive_message, #receive_result, #send_message, #send_result, #serve_message!, #stop!, #with_server_signals!

Methods included from Log

#_log, #_log_enabled=, #_log_enabled?, #_log_format, #_log_result, enabled, enabled=, included

Methods included from Initialization

#initialize

Methods included from AdditionalData

#[], #[]=, #_additional_data, #additional_data, #additional_data!, #additional_data=, included

Methods included from Message::Delay

#relative_message_delay!, #wait_for_delay!

Methods included from ASIR::ThreadVariable

included, setter

Constructor Details

This class inherits a constructor from ASIR::Transport

Instance Method Details

#_send_message(state) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/asir/transport/broadcast.rb', line 12

def _send_message state
  result = first_exception = nil
  transports.each do | transport |
    begin
      result = transport.send_message(state.message)
    rescue ::Exception => exc
      first_exception ||= exc
      _handle_send_message_exception! transport, state, exc
      raise exc unless @continue_on_exception
    end
  end
  if first_exception && @reraise_first_exception
    raise first_exception
  end
  state.result = Result.new(state.message, result)
end