class Handlers::ConnectorHandler
Connector events handler for connector client
Attributes
connections[RW]
Array of connections
count[RW]
Count of connections
Public Class Methods
new( broker, count, sasl_mechs, idle_timeout, max_frame_size, sasl_enabled, log_lib, exit_timer )
click to toggle source
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
Calls superclass method
Handlers::BasicHandler::new
# 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
Public Instance Methods
on_connection_open(_c)
click to toggle source
# File lib/handlers/connector_handler.rb, line 82 def on_connection_open(_c) exit_timer.reset if exit_timer end
on_container_start(container)
click to toggle source
Called when the event loop starts, connecting ConnectorHandler#count
number of connections
# 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