Class: RFlow::ForwardToInputPort

Inherits:
Connection show all
Defined in:
lib/rflow/connection.rb

Overview

Manually shuffle messages in-process from one output port to another output port. Can be used to get a Facade pattern effect - to have one component contain other components within it, shuttling messages in and out without making the internal component visible to the larger RFlow network.

Instance Attribute Summary

Attributes inherited from Connection

#config, #name, #options, #recv_callback, #uuid

Instance Method Summary collapse

Methods inherited from Connection

build, #connect_input!, #connect_output!, #input_port_key, #output_port_key

Constructor Details

#initialize(target_port) ⇒ ForwardToInputPort

Returns a new instance of ForwardToInputPort.



134
135
136
137
138
# File 'lib/rflow/connection.rb', line 134

def initialize(target_port)
  super(RFlow::Configuration::NullConnectionConfiguration.new)
  @receiver = target_port.component
  @target_port = target_port
end

Instance Method Details

#send_message(message) ⇒ void

This method returns an undefined value.

Override of #send_message which forwards the message to the target port.



142
143
144
# File 'lib/rflow/connection.rb', line 142

def send_message(message)
  @receiver.process_message(@target_port, nil, self, message)
end