Method: Mongo::Server::ConnectionBase#dispatch
- Defined in:
- lib/mongo/server/connection_base.rb
#dispatch(messages, context, options = {}) ⇒ Protocol::Message | nil
Note:
This method is named dispatch since ‘send’ is a core Ruby method on all objects.
Note:
For backwards compatibility, this method accepts the messages as an array. However, exactly one message must be given per invocation.
Dispatch a single message to the connection. If the message requires a response, a reply will be returned.
150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/mongo/server/connection_base.rb', line 150 def dispatch(, context, = {}) # The monitoring code does not correctly handle multiple messages, # and the driver internally does not send more than one message at # a time ever. Thus prohibit multiple message use for now. if .length != 1 raise ArgumentError, 'Can only dispatch one message at a time' end if description.unknown? raise Error::InternalDriverError, "Cannot dispatch a message on a connection with unknown description: #{description.inspect}" end = .first deliver(, context, ) end |