examples/get_a.rb in ferocia-rubywmq-2.0.7 vs examples/get_a.rb in ferocia-rubywmq-2.1.1
- old
+ new
@@ -1,16 +1,14 @@
#
# Sample : get() : Retrieve a single message from a queue
# If no messages are on the queue, message.data is nil
#
-require 'rubygems'
require 'wmq'
-WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
- qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:input) do |queue|
-
+WMQ::QueueManager.connect(q_mgr_name: 'REID') do |qmgr|
+ qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :input) do |queue|
message = WMQ::Message.new
- if queue.get(:message => message)
+ if queue.get(message: message)
puts "Data Received: #{message.data}"
else
puts 'No message available'
end
end