Sha256: cc86222a16f794d7803dc8fe5d2f5e91c30af5909fa5410c2aeb17723d891f2f

Contents?: true

Size: 675 Bytes

Versions: 3

Compression:

Stored size: 675 Bytes

Contents

#
# Sample : each() : Retrieve all messages from a queue that
#          have the same correlation id
#
require 'wmq'

WMQ::QueueManager.connect(q_mgr_name: 'REID') do |qmgr|
  qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :input) do |queue|
    message = WMQ::Message.new

    # Retrieve First message
    if queue.get(message: message)
      puts "Data Received: #{message.data}"

      #Retrieve all subsequent messages that have the same correlation id
      queue.each(message: message, match: WMQ::MQMO_MATCH_CORREL_ID) do |msg|
        puts "Matching Data Received: #{msg.data}"
      end
    else
      puts 'No message available'
    end
  end
  puts 'Completed.'
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
ferocia-rubywmq-2.1.1 examples/each_b.rb
rubywmq-2.1.1 examples/each_b.rb
rubywmq-2.1.0 examples/each_b.rb