Class: Handlers::ConnectorHandler
- Inherits:
-
BasicHandler
- Object
- Qpid::Proton::MessagingHandler
- BasicHandler
- Handlers::ConnectorHandler
- Defined in:
- lib/handlers/connector_handler.rb
Overview
Connector events handler for connector client
Instance Attribute Summary collapse
-
#connections ⇒ Object
Array of connections.
-
#count ⇒ Object
Count of connections.
Attributes inherited from BasicHandler
#broker, #exit_timer, #idle_timeout, #log_lib, #max_frame_size, #sasl_enabled, #sasl_mechs
Instance Method Summary collapse
-
#initialize(broker, count, sasl_mechs, idle_timeout, max_frame_size, sasl_enabled, log_lib, exit_timer) ⇒ ConnectorHandler
constructor
- Initialization of events handler for connector client ==== Connector events handler arguments broker
- URI of broker count
- Number of connections to create sasl_mechs
-
Allowed SASL mechanisms.
- #on_connection_open(_c) ⇒ Object
-
#on_container_start(container) ⇒ Object
Called when the event loop starts, connecting ConnectorHandler#count number of connections.
Constructor Details
#initialize(broker, count, sasl_mechs, idle_timeout, max_frame_size, sasl_enabled, log_lib, exit_timer) ⇒ ConnectorHandler
Initialization of events handler for connector client
Connector events handler arguments
- broker
-
URI of broker
- count
-
Number of connections to create
- sasl_mechs
-
Allowed SASL mechanisms
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/handlers/connector_handler.rb', line 34 def initialize( broker, count, sasl_mechs, idle_timeout, max_frame_size, sasl_enabled, log_lib, exit_timer ) super( broker, sasl_mechs, idle_timeout, max_frame_size, sasl_enabled, log_lib, exit_timer ) # Save count of connections @count = count # Initialize array of connections @connections = [] end |
Instance Attribute Details
#connections ⇒ Object
Array of connections
27 28 29 |
# File 'lib/handlers/connector_handler.rb', line 27 def connections @connections end |
#count ⇒ Object
Count of connections
25 26 27 |
# File 'lib/handlers/connector_handler.rb', line 25 def count @count end |
Instance Method Details
#on_connection_open(_c) ⇒ Object
82 83 84 |
# File 'lib/handlers/connector_handler.rb', line 82 def on_connection_open(_c) exit_timer.reset if exit_timer end |
#on_container_start(container) ⇒ Object
Called when the event loop starts, connecting ConnectorHandler#count number of connections
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/handlers/connector_handler.rb', line 61 def on_container_start(container) # Connecting count number of connections @count.times do # Save created connection(s) into array @connections.push(container.connect( # Set broker URI @broker, # Enable SASL authentication sasl_enabled: @sasl_enabled, # Enable insecure SASL mechanisms sasl_allow_insecure_mechs: true, # Set allowed SASL mechanisms sasl_allowed_mechs: @sasl_mechs, # Set idle timeout idle_timeout: @idle_timeout, # Set max frame size max_frame_size: @max_frame_size, )) end end |