Method: Stomp::Connection#receive
- Defined in:
- lib/stomp/connection.rb
#receive ⇒ Object
receive returns the next Message off of the wire. this can return nil in cases where:
-
the broker has closed the connection
-
the connection is not reliable
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/stomp/connection.rb', line 448 def receive() raise Stomp::Error::NoCurrentConnection if @closed_check && closed? super_result = __old_receive() if super_result.nil? && @reliable && !closed? errstr = "connection.receive returning EOF as nil - resetting connection.\n" unless slog(:on_miscerr, log_params, "es_recv: " + errstr) $stderr.print errstr end # !!! This initiates a re-connect !!! # The call to __old_receive() will in turn call socket(). Before # that we should change the target host, otherwise the host that # just failed may be attempted first. _reconn_prep() # super_result = __old_receive() end # if super_result.nil? && !@reliable @st.kill if @st # Kill ticker thread if any @rt.kill if @rt # Kill ticker thread if any close_socket() @closed = true warn 'warning: broker sent EOF, and connection not reliable' unless defined?(Test) end slog(:on_receive, log_params, super_result) return super_result end |