Sha256: 50b2592c51ae5330d348d7c7ae0263a6fe70fa0920f3c3e727c10c0fe111d07c

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

#
# Sample : put() : Put a message to a queue with a Refernce header
#          Open the queue so that multiple puts can be performed
#
require 'wmq'

# The Rules Format header2 (MQRFH2) allows a an XML-like string to be passed as a header
# to the data.
#
WMQ::QueueManager.connect(q_mgr_name: 'REID') do |qmgr|
  qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :output) do |queue|
    message      = WMQ::Message.new
    message.data = 'Hello World'

    message.headers = [
      {
        header_type: :rf_header_2,
        xml:         ['<hello>to the world</hello>', '<another>xml like string</another>'],
      }
    ]

    message.descriptor[:format] = WMQ::MQFMT_STRING

    queue.put(message: message)
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

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