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.
50 51 52 53 |
# File 'lib/omq/ffi/engine.rb', line 50 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.
47 48 49 |
# File 'lib/omq/ffi/engine.rb', line 47 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.
78 79 80 |
# File 'lib/omq/ffi/engine.rb', line 78 def join(group) @engine.send_cmd(:join, group) end |
#leave(group) ⇒ void
This method returns an undefined value.
Leaves a DISH group.
87 88 89 |
# File 'lib/omq/ffi/engine.rb', line 87 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.
60 61 62 |
# File 'lib/omq/ffi/engine.rb', line 60 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.
69 70 71 |
# File 'lib/omq/ffi/engine.rb', line 69 def unsubscribe(prefix) @engine.send_cmd(:unsubscribe, prefix.b) end |