Class: Protobuf::Rpc::Connectors::Zmq
- Defined in:
- lib/protobuf/rpc/connectors/zmq.rb
Constant Summary collapse
- RequestTimeout =
Class.new(RuntimeError)
- ZmqRecoverableError =
Class.new(RuntimeError)
- ZmqEagainError =
Class.new(RuntimeError)
- CLIENT_RETRIES =
Class Constants
(ENV['PB_CLIENT_RETRIES'] || 3)
Instance Attribute Summary
Attributes included from Common
Attributes inherited from Base
#complete_cb, #failure_cb, #options, #success_cb
Class Method Summary collapse
-
.ping_port_responses ⇒ Object
Class Methods.
- .zmq_context ⇒ Object
Instance Method Summary collapse
-
#log_signature ⇒ Object
Instance methods.
-
#send_request ⇒ Object
Start the request/response cycle.
Methods included from Logging
initialize_logger, #log_exception, #logger, #sign_message
Methods included from Common
#any_callbacks?, #complete, #data_callback, #failure, #initialize_stats, #parse_response, #post_init, #request_bytes, #request_caller, #setup_connection, #succeed, #timeout, #timeout_wrap, #validate_request_type!, #verify_callbacks, #verify_options!
Methods inherited from Base
#first_alive_load_balance?, #initialize, #ping_port, #ping_port_enabled?
Constructor Details
This class inherits a constructor from Protobuf::Rpc::Connectors::Base
Class Method Details
.ping_port_responses ⇒ Object
Class Methods
27 28 29 |
# File 'lib/protobuf/rpc/connectors/zmq.rb', line 27 def self.ping_port_responses @ping_port_responses ||= ::ThreadSafe::Cache.new end |
.zmq_context ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/protobuf/rpc/connectors/zmq.rb', line 31 def self.zmq_context @zmq_contexts ||= Hash.new do |hash, key| hash[key] = ZMQ::Context.new end @zmq_contexts[Process.pid] end |
Instance Method Details
#log_signature ⇒ Object
Instance methods
42 43 44 |
# File 'lib/protobuf/rpc/connectors/zmq.rb', line 42 def log_signature @_log_signature ||= "[client-#{self.class}]" end |
#send_request ⇒ Object
Start the request/response cycle. We implement the Lazy Pirate req/reply reliability pattern as laid out in the ZMQ Guide, Chapter 4.
51 52 53 54 |
# File 'lib/protobuf/rpc/connectors/zmq.rb', line 51 def send_request setup_connection send_request_with_lazy_pirate unless error? end |