Class: MCollective::Connector::Activemq::EventLogger
- Inherits:
-
Object
- Object
- MCollective::Connector::Activemq::EventLogger
- Defined in:
- lib/mcollective/connector/activemq.rb
Overview
Class for Stomp 1.1.9 callback based logging
Instance Method Summary collapse
- #on_connected(params = nil) ⇒ Object
- #on_connectfail(params = nil) ⇒ Object
- #on_connecting(params = nil) ⇒ Object
- #on_disconnect(params = nil) ⇒ Object
-
#on_hbfire(params, srind, curt) ⇒ Object
Log heart beat fires.
-
#on_hbread_fail(params, ticker_data) ⇒ Object
Stomp 1.1+ - heart beat read (receive) failed.
-
#on_hbwrite_fail(params, ticker_data) ⇒ Object
Stomp 1.1+ - heart beat send (transmit) failed.
- #on_miscerr(params, errstr) ⇒ Object
- #on_ssl_connected(params) ⇒ Object
- #on_ssl_connectfail(params) ⇒ Object
- #on_ssl_connecting(params) ⇒ Object
- #stomp_url(params) ⇒ Object
Instance Method Details
#on_connected(params = nil) ⇒ Object
118 119 120 121 |
# File 'lib/mcollective/connector/activemq.rb', line 118 def on_connected(params=nil) Log.info("Connected to #{stomp_url(params)}") rescue end |
#on_connectfail(params = nil) ⇒ Object
128 129 130 131 |
# File 'lib/mcollective/connector/activemq.rb', line 128 def on_connectfail(params=nil) Log.info("TCP Connection to #{stomp_url(params)} failed on attempt #{params[:cur_conattempts]}") rescue end |
#on_connecting(params = nil) ⇒ Object
113 114 115 116 |
# File 'lib/mcollective/connector/activemq.rb', line 113 def on_connecting(params=nil) Log.info("TCP Connection attempt %d to %s" % [params[:cur_conattempts], stomp_url(params)]) rescue end |
#on_disconnect(params = nil) ⇒ Object
123 124 125 126 |
# File 'lib/mcollective/connector/activemq.rb', line 123 def on_disconnect(params=nil) Log.info("Disconnected from #{stomp_url(params)}") rescue end |
#on_hbfire(params, srind, curt) ⇒ Object
Log heart beat fires
185 186 187 188 189 190 191 192 193 |
# File 'lib/mcollective/connector/activemq.rb', line 185 def on_hbfire(params, srind, curt) case srind when "receive_fire" Log.debug("Received heartbeat from %s: %s, %s" % [stomp_url(params), srind, curt]) when "send_fire" Log.debug("Publishing heartbeat to %s: %s, %s" % [stomp_url(params), srind, curt]) end rescue Exception => e end |
#on_hbread_fail(params, ticker_data) ⇒ Object
Stomp 1.1+ - heart beat read (receive) failed.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/mcollective/connector/activemq.rb', line 153 def on_hbread_fail(params, ticker_data) if ticker_data["lock_fail"] if params[:max_hbrlck_fails] == 0 # failure is disabled Log.debug("Heartbeat failed to acquire readlock for '%s': %s" % [stomp_url(params), ticker_data.inspect]) elsif ticker_data['lock_fail_count'] >= params[:max_hbrlck_fails] # we're about to force a disconnect Log.error("Heartbeat failed to acquire readlock for '%s': %s" % [stomp_url(params), ticker_data.inspect]) else Log.warn("Heartbeat failed to acquire readlock for '%s': %s" % [stomp_url(params), ticker_data.inspect]) end else if params[:max_hbread_fails] == 0 # failure is disabled Log.debug("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect]) elsif ticker_data['read_fail_count'] >= params[:max_hbread_fails] # we're about to force a reconnect Log.error("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect]) else Log.warn("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect]) end end rescue Exception => e end |
#on_hbwrite_fail(params, ticker_data) ⇒ Object
Stomp 1.1+ - heart beat send (transmit) failed.
179 180 181 182 |
# File 'lib/mcollective/connector/activemq.rb', line 179 def on_hbwrite_fail(params, ticker_data) Log.error("Heartbeat write failed from '%s': %s" % [stomp_url(params), ticker_data.inspect]) rescue Exception => e end |
#on_miscerr(params, errstr) ⇒ Object
133 134 135 136 |
# File 'lib/mcollective/connector/activemq.rb', line 133 def on_miscerr(params, errstr) Log.error("Unexpected error on connection #{stomp_url(params)}: #{errstr}") rescue end |
#on_ssl_connected(params) ⇒ Object
143 144 145 146 |
# File 'lib/mcollective/connector/activemq.rb', line 143 def on_ssl_connected(params) Log.info("SSL session established with #{stomp_url(params)}") rescue end |
#on_ssl_connectfail(params) ⇒ Object
148 149 150 |
# File 'lib/mcollective/connector/activemq.rb', line 148 def on_ssl_connectfail(params) Log.error("SSL session creation with #{stomp_url(params)} failed: #{params[:ssl_exception]}") end |
#on_ssl_connecting(params) ⇒ Object
138 139 140 141 |
# File 'lib/mcollective/connector/activemq.rb', line 138 def on_ssl_connecting(params) Log.info("Establishing SSL session with #{stomp_url(params)}") rescue end |
#stomp_url(params) ⇒ Object
195 196 197 |
# File 'lib/mcollective/connector/activemq.rb', line 195 def stomp_url(params) "%s://%s@%s:%d" % [ params[:cur_ssl] ? "stomp+ssl" : "stomp", params[:cur_login], params[:cur_host], params[:cur_port]] end |