Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Inner Inbound is now a Subscribe socket

  • Loading branch information...
commit 9b49f5473074fcaf4b7395bea70a346c4fbf1ee4 1 parent f65932b
@krakatoa krakatoa authored
Showing with 15 additions and 4 deletions.
  1. +6 −4 lib/channel.rb
  2. +9 −0 lib/reactor.rb
View
10 lib/channel.rb
@@ -35,10 +35,8 @@ def vm_inner_inbound_start
# It works by connecting to an IPC socket. In a future, it might be considered to
# enable tcp communication, so workers can be outside the local server.
- $stdout.puts "Connecting to the Inner Inbound (PULL) socket"
- #@socket = MaZMQ::Pull.new
- #@socket.connect :ipc, "/tmp/cucub-inner-inbound.sock"
- @socket = PanZMQ::Pull.new
+ $stdout.puts "Connecting to the Inner Inbound (SUBSCRIBE) socket"
+ @socket = PanZMQ::Subscribe.new
@socket.connect "ipc:///tmp/cucub-inner-inbound.sock"
@socket.register
@socket
@@ -62,6 +60,10 @@ def vm_inner_outbound_start
# @socket.recv_string#(ZMQ::NOBLOCK)
#end
+ def listen(class_name)
+ @socket.listen(class_name)
+ end
+
def on_receive(&block)
@socket.on_receive { |msg|
block.call(msg)
View
9 lib/reactor.rb
@@ -40,6 +40,7 @@ def run
plug_actors
init_channels
+ set_inbound_listen
$stdout.puts "receiving"
# This should be on inbound creation method
@@ -73,6 +74,12 @@ def run
end
+ def set_inbound_listen
+ Cucub::VM.instance.configuration.classes.each do |class_name|
+ @inbound.listen("#{class_name}##{Cucub::VM.instance.uid}")
+ end
+ end
+
def plug_actors
Cucub::ObjectsHub.instance.objects.each do |object|
actor = Cucub::Actor.new(object)
@@ -118,6 +125,8 @@ def container_stop
end
def unwrap_message(message)
+ message = message.split("##{Cucub::VM.instance.uid} ")[1]
+
unserialized = Cucub::Message.parse(message)
unserialized
end
Please sign in to comment.
Something went wrong with that request. Please try again.