Class: OMQ::FFI::Engine::RoutingStub
- Inherits:
-
Object
- Object
- OMQ::FFI::Engine::RoutingStub
- Defined in:
- lib/omq/ffi/engine.rb
Overview
Routing stub that delegates subscribe/unsubscribe/join/leave to libzmq socket options via the I/O thread.
Instance Attribute Summary collapse
-
#subscriber_joined ⇒ Async::Promise
readonly
Resolved when a subscriber joins.
Instance Method Summary collapse
-
#initialize(engine) ⇒ RoutingStub
constructor
A new instance of RoutingStub.
-
#join(group) ⇒ void
Joins a DISH group for receiving RADIO messages.
-
#leave(group) ⇒ void
Leaves a DISH group.
-
#subscribe(prefix) ⇒ void
Subscribes to messages matching the given prefix.
-
#unsubscribe(prefix) ⇒ void
Removes a subscription for the given prefix.
Constructor Details
#initialize(engine) ⇒ RoutingStub
Returns a new instance of RoutingStub.
45 46 47 48 |
# File 'lib/omq/ffi/engine.rb', line 45 def initialize(engine) @engine = engine @subscriber_joined = Async::Promise.new end |
Instance Attribute Details
#subscriber_joined ⇒ Async::Promise (readonly)
Returns resolved when a subscriber joins.
42 43 44 |
# File 'lib/omq/ffi/engine.rb', line 42 def subscriber_joined @subscriber_joined end |
Instance Method Details
#join(group) ⇒ void
This method returns an undefined value.
Joins a DISH group for receiving RADIO messages.
73 74 75 |
# File 'lib/omq/ffi/engine.rb', line 73 def join(group) @engine.send_cmd(:join, group) end |
#leave(group) ⇒ void
This method returns an undefined value.
Leaves a DISH group.
82 83 84 |
# File 'lib/omq/ffi/engine.rb', line 82 def leave(group) @engine.send_cmd(:leave, group) end |
#subscribe(prefix) ⇒ void
This method returns an undefined value.
Subscribes to messages matching the given prefix.
55 56 57 |
# File 'lib/omq/ffi/engine.rb', line 55 def subscribe(prefix) @engine.send_cmd(:subscribe, prefix.b) end |
#unsubscribe(prefix) ⇒ void
This method returns an undefined value.
Removes a subscription for the given prefix.
64 65 66 |
# File 'lib/omq/ffi/engine.rb', line 64 def unsubscribe(prefix) @engine.send_cmd(:unsubscribe, prefix.b) end |