Class: OMQ::Options
- Inherits:
-
Object
- Object
- OMQ::Options
- Defined in:
- lib/omq/options.rb
Overview
Pure Ruby socket options.
All timeouts are in seconds (Numeric) or nil (no timeout). HWM values are integers.
Constant Summary collapse
- DEFAULT_HWM =
1000
Instance Attribute Summary collapse
-
#conflate ⇒ Boolean
Keep only the latest message per topic (default false).
-
#heartbeat_interval ⇒ Numeric?
PING interval in seconds (nil = disabled).
-
#heartbeat_timeout ⇒ Numeric?
Time without traffic before closing (nil = use heartbeat_interval).
-
#heartbeat_ttl ⇒ Numeric?
TTL advertised in PING (nil = use heartbeat_interval).
-
#identity ⇒ String
Socket identity for ROUTER addressing (default “”).
-
#linger ⇒ Numeric
Linger period in seconds on close (Float::INFINITY = wait forever, 0 = immediate drop).
-
#max_message_size ⇒ Integer?
Maximum message size in bytes.
-
#mechanism ⇒ Protocol::ZMTP::Mechanism::Null, Protocol::ZMTP::Mechanism::Curve
Security mechanism.
-
#on_mute ⇒ Symbol
Mute strategy (:block, :drop_newest, :drop_oldest).
-
#qos ⇒ Integer
Quality of service level (0 = fire-and-forget).
-
#rcvbuf ⇒ Integer?
SO_RCVBUF size in bytes (nil = OS default).
-
#read_timeout ⇒ Numeric?
(also: #recv_timeout)
Read timeout in seconds (nil = no timeout).
-
#reconnect_interval ⇒ Numeric, Range
Reconnect interval in seconds, or Range for exponential backoff.
-
#recv_hwm ⇒ Integer
Receive high water mark (default 1000, 0 = unbounded).
-
#router_mandatory ⇒ Boolean
(also: #router_mandatory?)
Raise on unroutable messages (default false).
-
#send_hwm ⇒ Integer
Send high water mark (default 1000, 0 = unbounded).
-
#sndbuf ⇒ Integer?
SO_SNDBUF size in bytes (nil = OS default).
-
#write_timeout ⇒ Numeric?
(also: #send_timeout)
Write timeout in seconds (nil = no timeout).
Instance Method Summary collapse
-
#initialize(linger: Float::INFINITY) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(linger: Float::INFINITY) ⇒ Options
Returns a new instance of Options.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/omq/options.rb', line 17 def initialize(linger: Float::INFINITY) @send_hwm = DEFAULT_HWM @recv_hwm = DEFAULT_HWM @linger = linger @identity = "".b @router_mandatory = false @read_timeout = nil # seconds, nil = no timeout @write_timeout = nil @reconnect_interval = 0.1 # seconds; Range sets backoff min..max @heartbeat_interval = nil # seconds, nil = disabled @heartbeat_ttl = nil # seconds, nil = use heartbeat_interval @heartbeat_timeout = nil # seconds, nil = use heartbeat_interval @max_message_size = nil # bytes, nil = unlimited @conflate = false @sndbuf = nil # bytes, nil = OS default @rcvbuf = nil # bytes, nil = OS default @on_mute = :block # :block, :drop_newest, :drop_oldest @mechanism = Protocol::ZMTP::Mechanism::Null.new @qos = 0 # 0 = fire-and-forget, 1 = at-least-once (see omq-qos gem) end |
Instance Attribute Details
#conflate ⇒ Boolean
Returns keep only the latest message per topic (default false).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#heartbeat_interval ⇒ Numeric?
Returns PING interval in seconds (nil = disabled).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#heartbeat_timeout ⇒ Numeric?
Returns time without traffic before closing (nil = use heartbeat_interval).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#heartbeat_ttl ⇒ Numeric?
Returns TTL advertised in PING (nil = use heartbeat_interval).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#identity ⇒ String
Returns socket identity for ROUTER addressing (default “”).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#linger ⇒ Numeric
Returns linger period in seconds on close (Float::INFINITY = wait forever, 0 = immediate drop).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#max_message_size ⇒ Integer?
Returns maximum message size in bytes.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#mechanism ⇒ Protocol::ZMTP::Mechanism::Null, Protocol::ZMTP::Mechanism::Curve
Returns security mechanism.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#on_mute ⇒ Symbol
Returns mute strategy (:block, :drop_newest, :drop_oldest).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#qos ⇒ Integer
Returns quality of service level (0 = fire-and-forget).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#rcvbuf ⇒ Integer?
Returns SO_RCVBUF size in bytes (nil = OS default).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#read_timeout ⇒ Numeric? Also known as: recv_timeout
Returns read timeout in seconds (nil = no timeout).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#reconnect_interval ⇒ Numeric, Range
Returns reconnect interval in seconds, or Range for exponential backoff.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#recv_hwm ⇒ Integer
Returns receive high water mark (default 1000, 0 = unbounded).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#router_mandatory ⇒ Boolean Also known as: router_mandatory?
Returns raise on unroutable messages (default false).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#send_hwm ⇒ Integer
Returns send high water mark (default 1000, 0 = unbounded).
77 78 79 |
# File 'lib/omq/options.rb', line 77 def send_hwm @send_hwm end |
#sndbuf ⇒ Integer?
Returns SO_SNDBUF size in bytes (nil = OS default).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |
#write_timeout ⇒ Numeric? Also known as: send_timeout
Returns write timeout in seconds (nil = no timeout).
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/omq/options.rb', line 77 attr_accessor :send_hwm, :recv_hwm, :linger, :identity, :router_mandatory, :conflate, :read_timeout, :write_timeout, :reconnect_interval, :heartbeat_interval, :heartbeat_ttl, :heartbeat_timeout, :max_message_size, :sndbuf, :rcvbuf, :on_mute, :mechanism, :qos |