Class: Miu::Forwarder
- Inherits:
-
Object
- Object
- Miu::Forwarder
- Defined in:
- lib/miu/forwarder.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(options = {}) ⇒ Forwarder
constructor
A new instance of Forwarder.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Forwarder
Returns a new instance of Forwarder.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/miu/forwarder.rb', line 7 def initialize( = {}) @pub = pub_socket_class.new @pub.bind Miu::Socket.build_address([:pub_host], [:pub_port]) @sub = sub_socket_class.new @sub.bind Miu::Socket.build_address([:sub_host], [:sub_port]) @sub.subscribe '' if [:bridge_port] @bridge = sub_socket_class.new @bridge.connect Miu::Socket.build_address([:bridge_host], [:bridge_port]) @bridge.subscribe '' end end |
Instance Method Details
#close ⇒ Object
22 23 24 25 26 |
# File 'lib/miu/forwarder.rb', line 22 def close @bridge.close if @bridge @sub.close @pub.close end |