Class: OMQ::Ractor::TopicMarshalConnection
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- OMQ::Ractor::TopicMarshalConnection
- Includes:
- TransparentDelegator
- Defined in:
- lib/omq/ractor.rb
Overview
Instance Method Summary collapse
-
#initialize(conn, cache) ⇒ TopicMarshalConnection
constructor
A new instance of TopicMarshalConnection.
-
#receive_message ⇒ Array<String>
Deserialized message with topic as first element.
- #send_message(parts) ⇒ void
- #write_message(parts) ⇒ void
- #write_messages(batch) ⇒ void
Methods included from TransparentDelegator
Constructor Details
#initialize(conn, cache) ⇒ TopicMarshalConnection
Returns a new instance of TopicMarshalConnection.
146 147 148 149 |
# File 'lib/omq/ractor.rb', line 146 def initialize(conn, cache) super(conn) @cache = cache end |
Instance Method Details
#receive_message ⇒ Array<String>
Returns deserialized message with topic as first element.
174 175 176 177 |
# File 'lib/omq/ractor.rb', line 174 def parts = super [parts[0], *Marshal.load(parts[1])] end |
#send_message(parts) ⇒ void
This method returns an undefined value.
154 155 156 |
# File 'lib/omq/ractor.rb', line 154 def (parts) super([parts[0], @cache.marshal(parts[1..])]) end |
#write_message(parts) ⇒ void
This method returns an undefined value.
161 162 163 |
# File 'lib/omq/ractor.rb', line 161 def (parts) super([parts[0], @cache.marshal(parts[1..])]) end |
#write_messages(batch) ⇒ void
This method returns an undefined value.
168 169 170 |
# File 'lib/omq/ractor.rb', line 168 def (batch) super(batch.map { |parts| [parts[0], @cache.marshal(parts[1..])] }) end |