examples/logexamp.rb in stomp-1.1.10 vs examples/logexamp.rb in stomp-1.2.0
- old
+ new
@@ -12,14 +12,15 @@
llog.level = Logger::DEBUG
llog.debug "LE Starting"
# //////////////////////////////////////////////////////////////////////////////
mylog = Slogger::new # The client provided STOMP callback logger
+# -*- encoding: utf-8 -*-
# //////////////////////////////////////////////////////////////////////////////
user = ENV['STOMP_USER'] ? ENV['STOMP_USER'] : 'guest'
-password = ENV['STOMP_PASSWORD'] ? ENV['STOMP_PASSWORD'] : 'guestpw'
+password = ENV['STOMP_PASSWORD'] ? ENV['STOMP_PASSWORD'] : 'guest'
host = ENV['STOMP_HOST'] ? ENV['STOMP_HOST'] : 'localhost'
port = ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 61613
# //////////////////////////////////////////////////////////////////////////////
# A hash type connect *MUST* be used to enable callback logging.
# //////////////////////////////////////////////////////////////////////////////
@@ -31,20 +32,35 @@
:max_reconnect_attempts => 5,
}
# //////////////////////////////////////////////////////////////////////////////
# For a Connection:
+llog.debug "LE Connection processing starts"
conn = Stomp::Connection.new(hash)
conn.disconnect
# //////////////////////////////////////////////////////////////////////////////
llog.debug "LE Connection processing complete"
# //////////////////////////////////////////////////////////////////////////////
# For a Client:
+llog.debug "LE Client processing starts"
conn = Stomp::Client.new(hash)
conn.close
# //////////////////////////////////////////////////////////////////////////////
-# llog.debug "LE Client processing complete"
+llog.debug "LE Client processing complete"
+
+# //////////////////////////////////////////////////////////////////////////////
+# For a Connection with other calls:
+llog.debug "LE Connection Enhanced processing starts"
+conn = Stomp::Connection.new(hash)
+#
+dest = "/queue/loggerq1"
+conn.publish dest, "a logger message"
+conn.subscribe dest
+msg = conn.receive
+conn.disconnect
+# //////////////////////////////////////////////////////////////////////////////
+llog.debug "LE Connection Enhanced processing complete"
# //////////////////////////////////////////////////////////////////////////////
llog.debug "LE Ending"