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