Class: Handlers::SRCommonHandler
- Inherits:
-
BasicHandler
- Object
- Qpid::Proton::MessagingHandler
- BasicHandler
- Handlers::SRCommonHandler
- Defined in:
- lib/handlers/sr_common_handler.rb
Overview
Common events handler for sender and receiver client
Direct Known Subclasses
Instance Attribute Summary collapse
-
#auto_settle_off ⇒ Object
Auto settle off.
-
#idle_timeout ⇒ Object
Idle timeout.
-
#log_lib ⇒ Object
Client library logging.
-
#log_msgs ⇒ Object
Format of log.
-
#max_frame_size ⇒ Object
Max frame size.
-
#msg_content_hashed ⇒ Object
Content hashed.
-
#sasl_enabled ⇒ Object
SASL enabled.
Attributes inherited from BasicHandler
#broker, #exit_timer, #sasl_mechs
Instance Method Summary collapse
-
#initialize(broker, log_msgs, msg_content_hashed, sasl_mechs, idle_timeout, max_frame_size, sasl_enabled, log_lib, auto_settle_off, exit_timer) ⇒ SRCommonHandler
constructor
- Initialization of common events handler for sender and receiver client ==== Common events handler arguments broker
- URI of broker log_msgs
- format of message(s) log sasl_mechs
-
allowed SASL mechanisms.
-
#on_error(condition) ⇒ Object
Default for un-handled errors is to raise an exception.
-
#print_message(msg) ⇒ Object
- Print of sent/received message ==== Arguments msg
-
message to print.
Constructor Details
#initialize(broker, log_msgs, msg_content_hashed, sasl_mechs, idle_timeout, max_frame_size, sasl_enabled, log_lib, auto_settle_off, exit_timer) ⇒ SRCommonHandler
Initialization of common events handler for sender and receiver client
Common events handler arguments
- broker
-
URI of broker
- log_msgs
-
format of message(s) log
- sasl_mechs
-
allowed SASL mechanisms
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/handlers/sr_common_handler.rb', line 48 def initialize( broker, log_msgs, msg_content_hashed, sasl_mechs, idle_timeout, max_frame_size, sasl_enabled, log_lib, auto_settle_off, exit_timer ) super( broker, sasl_mechs, idle_timeout, max_frame_size, sasl_enabled, log_lib, exit_timer ) # Save message(s) log format @log_msgs = log_msgs # Save message(s) content hashed @msg_content_hashed = msg_content_hashed # Save auto settle off @auto_settle_off = auto_settle_off end |
Instance Attribute Details
#auto_settle_off ⇒ Object
Auto settle off
41 42 43 |
# File 'lib/handlers/sr_common_handler.rb', line 41 def auto_settle_off @auto_settle_off end |
#idle_timeout ⇒ Object
Idle timeout
33 34 35 |
# File 'lib/handlers/sr_common_handler.rb', line 33 def idle_timeout @idle_timeout end |
#log_lib ⇒ Object
Client library logging
39 40 41 |
# File 'lib/handlers/sr_common_handler.rb', line 39 def log_lib @log_lib end |
#log_msgs ⇒ Object
Format of log
29 30 31 |
# File 'lib/handlers/sr_common_handler.rb', line 29 def log_msgs @log_msgs end |
#max_frame_size ⇒ Object
Max frame size
35 36 37 |
# File 'lib/handlers/sr_common_handler.rb', line 35 def max_frame_size @max_frame_size end |
#msg_content_hashed ⇒ Object
Content hashed
31 32 33 |
# File 'lib/handlers/sr_common_handler.rb', line 31 def msg_content_hashed @msg_content_hashed end |
#sasl_enabled ⇒ Object
SASL enabled
37 38 39 |
# File 'lib/handlers/sr_common_handler.rb', line 37 def sasl_enabled @sasl_enabled end |
Instance Method Details
#on_error(condition) ⇒ Object
Default for un-handled errors is to raise an exception
92 93 94 |
# File 'lib/handlers/sr_common_handler.rb', line 92 def on_error(condition) raise condition end |
#print_message(msg) ⇒ Object
Print of sent/received message
Arguments
- msg
-
message to print
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/handlers/sr_common_handler.rb', line 80 def (msg) case @log_msgs when "body" Formatters::BasicFormatter.new(msg, @msg_content_hashed).print when "dict" Formatters::DictFormatter.new(msg, @msg_content_hashed).print when "interop" Formatters::InteropFormatter.new(msg, @msg_content_hashed).print end end |