Class: Protobuf::Rpc::Connectors::Zmq
- Includes:
- Logging
- 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 inherited from Base
#complete_cb, #error, #failure_cb, #options, #stats, #success_cb
Class Method Summary collapse
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 inherited from Base
#any_callbacks?, #complete, #data_callback, #failure, #first_alive_load_balance?, #initialize, #initialize_stats, #parse_response, #ping_port, #ping_port_enabled?, #request_bytes, #request_caller, #request_fields, #setup_connection, #succeed, #timeout, #timeout_wrap, #validate_request_type!, #verify_callbacks, #verify_options!
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(reload = false) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/protobuf/rpc/connectors/zmq.rb', line 31 def self.zmq_context(reload = false) @zmq_contexts = nil if reload @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
43 44 45 |
# File 'lib/protobuf/rpc/connectors/zmq.rb', line 43 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.
52 53 54 55 |
# File 'lib/protobuf/rpc/connectors/zmq.rb', line 52 def send_request setup_connection send_request_with_lazy_pirate unless error? end |