ferocia-rubywmq 2.0.7 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +10 -0
- data/Gemfile.lock +36 -0
- data/LICENSE.txt +1 -1
- data/README.md +36 -47
- data/Rakefile +14 -39
- data/examples/each_a.rb +2 -3
- data/examples/each_b.rb +4 -5
- data/examples/each_header.rb +5 -6
- data/examples/files_to_q.rb +7 -8
- data/examples/get_a.rb +3 -5
- data/examples/get_client.rb +9 -10
- data/examples/put1_a.rb +2 -3
- data/examples/put1_b.rb +4 -7
- data/examples/put1_c.rb +6 -6
- data/examples/put_a.rb +0 -2
- data/examples/put_b.rb +5 -7
- data/examples/put_dlh.rb +11 -12
- data/examples/put_dynamic_q.rb +7 -7
- data/examples/put_group_a.rb +3 -4
- data/examples/put_group_b.rb +7 -7
- data/examples/put_rfh.rb +13 -11
- data/examples/put_rfh2_a.rb +9 -10
- data/examples/put_rfh2_b.rb +9 -9
- data/examples/put_xmit_q.rb +63 -8
- data/examples/q_to_files.rb +6 -7
- data/examples/request.rb +20 -18
- data/examples/server.rb +19 -16
- data/ext/extconf.rb +2 -1
- data/ext/extconf_client.rb +3 -3
- data/ext/generate/generate_const.rb +30 -23
- data/ext/generate/generate_reason.rb +70 -72
- data/ext/generate/generate_structs.rb +20 -19
- data/ext/generate/wmq_structs.erb +67 -67
- data/ext/wmq.c +0 -16
- data/ext/wmq.h +0 -16
- data/ext/wmq_message.c +8 -24
- data/ext/wmq_mq_load.c +5 -17
- data/ext/wmq_queue.c +73 -90
- data/ext/wmq_queue_manager.c +71 -87
- data/lib/wmq/message.rb +36 -34
- data/lib/wmq/queue_manager.rb +30 -23
- data/lib/wmq/version.rb +1 -1
- data/rubywmq.gemspec +44 -0
- data/test/queue_manager_test.rb +334 -0
- data/test/test_helper.rb +14 -0
- metadata +13 -25
- data/ferocia-rubywmq.gemspec +0 -33
- data/tests/test.rb +0 -318
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 76d55f39d0ec09a6b0f898cf1e895bbd0d16589436d12956316d14f2d9f71a96
|
4
|
+
data.tar.gz: 1061d31e119778d01bb74a6b66b31ec045521ecbe9ee99a987a4e2394c832bba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9226aba45fa69bd693fbec112b6195303c87ebd635c079fcb56cce9f10268c9093314f2f737ec882fde1f2644212a60c28a869def06535f6e829ededb2ac14d
|
7
|
+
data.tar.gz: e5f43e9f055c9b3d35d5479c70e554e6267c892ff396adcb7a74ffa1fd9f64c797212823e6d3e6baba729ccbe528e050d714e42bcfb209019f091113c84a8baa
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ferocia-rubywmq (2.1.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ansi (1.5.0)
|
10
|
+
awesome_print (1.8.0)
|
11
|
+
builder (3.2.4)
|
12
|
+
minitest (5.14.1)
|
13
|
+
minitest-reporters (1.4.2)
|
14
|
+
ansi
|
15
|
+
builder
|
16
|
+
minitest (>= 5.0)
|
17
|
+
ruby-progressbar
|
18
|
+
minitest-stub_any_instance (1.0.2)
|
19
|
+
rake (13.0.1)
|
20
|
+
ruby-progressbar (1.10.1)
|
21
|
+
shoulda-context (2.0.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
awesome_print
|
28
|
+
ferocia-rubywmq!
|
29
|
+
minitest
|
30
|
+
minitest-reporters
|
31
|
+
minitest-stub_any_instance
|
32
|
+
rake
|
33
|
+
shoulda-context
|
34
|
+
|
35
|
+
BUNDLED WITH
|
36
|
+
2.1.4
|
data/LICENSE.txt
CHANGED
@@ -186,7 +186,7 @@
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
187
187
|
identification within third-party archives.
|
188
188
|
|
189
|
-
Copyright 2006 -
|
189
|
+
Copyright 2006 - 2015 J. Reid Morrison
|
190
190
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
192
192
|
you may not use this file except in compliance with the License.
|
data/README.md
CHANGED
@@ -1,17 +1,24 @@
|
|
1
|
-
|
1
|
+
# rubywmq
|
2
2
|
|
3
3
|
RubyWMQ is a high performance native Ruby interface into WebSphere MQ.
|
4
4
|
|
5
5
|
* http://github.com/reidmorrison/rubywmq
|
6
6
|
|
7
|
+
### Project Status
|
8
|
+
|
9
|
+
RubyWMQ is no longer under active development. Pull Requests for new features / bug fixes will be accepted though.
|
10
|
+
Anyone interested in taking over development of RubyWMQ can contact me directly.
|
11
|
+
|
12
|
+
Note: IBM MQSeries encryption is not supported. Pull requests with this feature are welcome!
|
13
|
+
|
7
14
|
### Features
|
8
15
|
|
9
16
|
The Ruby WMQ interface currently supports the following features:
|
10
17
|
|
11
18
|
High performance
|
12
19
|
|
13
|
-
* Able to read over
|
14
|
-
*
|
20
|
+
* Able to read over 2,000 messages per second from a Queue
|
21
|
+
* Non-persistent messages, < 4K each, MQ V6
|
15
22
|
|
16
23
|
Full support for the entire MQ Administration interface (MQAI)
|
17
24
|
|
@@ -44,16 +51,14 @@ Single Ruby WMQ auto-detection library that concurrently supports:
|
|
44
51
|
|
45
52
|
Includes latest client connection options such as SSL
|
46
53
|
|
47
|
-
Tested with WebSphere MQ V5.3, V6, V7,
|
54
|
+
Tested with WebSphere MQ V5.3, V6, V7, V7.5, and V8
|
48
55
|
|
49
56
|
Is written in C to ensure easier portability and performance
|
50
57
|
|
51
58
|
### Compatibility
|
52
59
|
|
53
|
-
Ruby
|
54
|
-
|
55
|
-
* RubyWMQ only works on Ruby MRI on with Ruby 1.8.7, Ruby 1.9.3, or greater
|
56
|
-
* For JRuby, see http://github.com/reidmorrison/jruby-jms
|
60
|
+
* Ruby 1.9 or greater
|
61
|
+
* Not designed for JRuby, use [jruby-jms](https://github.com/reidmorrison/jruby-jms)
|
57
62
|
|
58
63
|
WebSphere MQ
|
59
64
|
|
@@ -64,21 +69,18 @@ WebSphere MQ
|
|
64
69
|
## Example
|
65
70
|
|
66
71
|
```ruby
|
67
|
-
require 'rubygems'
|
68
72
|
require 'wmq'
|
69
73
|
|
70
74
|
# Connect to a local queue manager called 'TEST' and put a single message
|
71
75
|
# on the queue 'TEST.QUEUE'
|
72
|
-
WMQ::QueueManager.connect(:
|
73
|
-
qmgr.put(:
|
76
|
+
WMQ::QueueManager.connect(q_mgr_name: 'TEST') do |qmgr|
|
77
|
+
qmgr.put(q_name: 'TEST.QUEUE', data: 'Hello World')
|
74
78
|
end
|
75
79
|
```
|
76
80
|
|
77
81
|
## More Examples
|
78
82
|
|
79
|
-
|
80
|
-
are installed as part of the Gem under the 'examples' sub-directory. The examples can
|
81
|
-
also be be viewed at https://github.com/reidmorrison/rubywmq/tree/master/examples
|
83
|
+
The examples below are all available at https://github.com/reidmorrison/rubywmq/tree/master/examples
|
82
84
|
|
83
85
|
Put one message to a Queue (Without opening the queue)
|
84
86
|
|
@@ -149,6 +151,8 @@ Also install RubyGems and ruby-dev or ruby-sdk packages if not already installed
|
|
149
151
|
|
150
152
|
Install the [WebSphere MQ Client and/or Server](http://www.ibm.com/developerworks/downloads/ws/wmq/)
|
151
153
|
|
154
|
+
* Develop on [WebSphere MQ Advanced](https://www.ibm.com/developerworks/community/blogs/messaging/entry/develop_on_websphere_mq_advanced_at_no_charge?lang=en#) at no charge!
|
155
|
+
|
152
156
|
* Note: Install the Development Toolkit (SDK) and Client
|
153
157
|
|
154
158
|
Install RubyWMQ Gem
|
@@ -186,7 +190,7 @@ Download and install the Ruby installer from http://rubyinstaller.org/downloads/
|
|
186
190
|
|
187
191
|
Download and install the Development Kit from the same site
|
188
192
|
|
189
|
-
* Extract files into c:\
|
193
|
+
* Extract files into c:\Devkit
|
190
194
|
|
191
195
|
Open a command prompt and run the commands below:
|
192
196
|
|
@@ -199,22 +203,28 @@ If you experience any difficulties, see https://github.com/oneclick/rubyinsta
|
|
199
203
|
|
200
204
|
Install the [WebSphere MQ Client and/or Server](http://www.ibm.com/developerworks/downloads/ws/wmq/)
|
201
205
|
|
206
|
+
* Develop on [WebSphere MQ Advanced](https://www.ibm.com/developerworks/community/blogs/messaging/entry/develop_on_websphere_mq_advanced_at_no_charge?lang=en#) at no charge!
|
207
|
+
|
202
208
|
* Note: Install the Development Toolkit (SDK) and Client
|
203
209
|
|
204
210
|
#### Install the RubyWMQ Gem
|
205
211
|
|
206
212
|
call "c:\DevKit\devkitvars.bat"
|
207
|
-
gem install rubywmq
|
213
|
+
gem install rubywmq
|
214
|
+
|
215
|
+
If WebSphere MQ is installed in the non-default location:
|
216
|
+
|
217
|
+
gem install rubywmq --platform=ruby -- '--with-mqm-include="C:\Program Files\IBM\WebSphere MQ\Tools\c\include"'
|
208
218
|
|
209
219
|
#### Installation Errors
|
210
220
|
|
211
221
|
Use this command to find the directory in which the gems are installed
|
212
222
|
|
213
|
-
gem
|
223
|
+
gem which rubywmq
|
214
224
|
|
215
225
|
The path to the rubywmq gem will be something like
|
216
226
|
|
217
|
-
C:\
|
227
|
+
C:\Ruby22\lib\ruby\gems\2.2.0\gems\rubywmq-2.0.3\ext
|
218
228
|
|
219
229
|
When WebSphere MQ is not installed in the default location, change to the directory
|
220
230
|
above and call the build command directly while supplying the location explicitly:
|
@@ -235,7 +245,6 @@ Create a local queue called TEST.QUEUE
|
|
235
245
|
Run the following Ruby Code in an irb session:
|
236
246
|
|
237
247
|
```ruby
|
238
|
-
require 'rubygems'
|
239
248
|
require 'wmq'
|
240
249
|
WMQ::QueueManager.connect(:q_mgr_name=>'TEST') do |qmgr|
|
241
250
|
qmgr.put(:q_name=>'TEST.QUEUE', :data => 'Hello World')
|
@@ -256,7 +265,7 @@ is installed locally. This prevents issues with having to statically link with
|
|
256
265
|
both the client and server libraries and then having to select the "correct"
|
257
266
|
one on startup.
|
258
267
|
|
259
|
-
Additionally, this approach allows RubyWMQ to be simultaneously
|
268
|
+
Additionally, this approach allows RubyWMQ to be simultaneously connected to a local
|
260
269
|
Queue Manager via server bindings and to a remote Queue Manager using Client bindings.
|
261
270
|
|
262
271
|
Instead of hard coding all the MQ C Structures and return codes into RubyWMQ, it
|
@@ -359,41 +368,21 @@ dis channel(*) chltype(SVRCONN)
|
|
359
368
|
* Look for the channel name the application is using.
|
360
369
|
* Note: the channel name is case-sensitive.
|
361
370
|
|
362
|
-
##
|
363
|
-
|
364
|
-
Ruby WMQ Community Support Mailing List: <http://rubyforge.org/mailman/listinfo/rubywmq-misc>
|
365
|
-
|
366
|
-
Feature and Bug Reports: <http://github.com/reidmorrison/rubywmq/issues>
|
367
|
-
|
368
|
-
## Contributing
|
369
|
-
|
370
|
-
Once you've made your great commits:
|
371
|
+
## Versioning
|
371
372
|
|
372
|
-
|
373
|
-
2. Create a topic branch - `git checkout -b my_branch`
|
374
|
-
3. Push to your branch - `git push origin my_branch`
|
375
|
-
4. Create an [Issue](http://github.com/reidmorrison/rubywmq/issues) with a link to your branch
|
376
|
-
5. That's it!
|
377
|
-
|
378
|
-
## Meta
|
379
|
-
|
380
|
-
* Code: `git clone git://github.com/reidmorrison/rubywmq.git`
|
381
|
-
* Home: <http://github.com/reidmorrison/rubywmq>
|
382
|
-
* Bugs: <http://github.com/reidmorrison/rubywmq/issues>
|
383
|
-
* Gems: <http://rubygems.org/gems/rubywmq>
|
384
|
-
|
385
|
-
This project uses [Semantic Versioning](http://semver.org/).
|
373
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
386
374
|
|
387
375
|
## Author
|
388
376
|
|
389
|
-
Reid Morrison
|
377
|
+
[Reid Morrison](https://github.com/reidmorrison) :: @reidmorrison
|
378
|
+
|
379
|
+
## Contributors
|
390
380
|
|
391
|
-
|
392
|
-
the wonderful world of Ruby
|
381
|
+
* Edwin Fine - RFH parsing code
|
393
382
|
|
394
383
|
## License
|
395
384
|
|
396
|
-
Copyright 2006 -
|
385
|
+
Copyright 2006 - 2015 J. Reid Morrison
|
397
386
|
|
398
387
|
Licensed under the Apache License, Version 2.0 (the "License");
|
399
388
|
you may not use this file except in compliance with the License.
|
data/Rakefile
CHANGED
@@ -1,52 +1,27 @@
|
|
1
|
-
lib = File.expand_path('../lib/', __FILE__)
|
2
|
-
$:.unshift lib unless $:.include?(lib)
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'rubygems/package'
|
6
1
|
require 'rake/clean'
|
7
2
|
require 'rake/testtask'
|
8
|
-
require 'date'
|
9
|
-
require 'wmq/version'
|
10
3
|
|
11
|
-
|
12
|
-
task :binary do |t|
|
13
|
-
# Move compiled files into locations for repackaging as a binary gem
|
14
|
-
FileUtils.mkdir_p('lib/wmq')
|
15
|
-
Dir['ext/lib/*.rb'].each{|file| FileUtils.copy(file, File.join('lib/wmq', File.basename(file)))}
|
16
|
-
FileUtils.copy('ext/wmq.so', 'lib/wmq/wmq.so')
|
4
|
+
require_relative 'lib/wmq/version'
|
17
5
|
|
18
|
-
|
19
|
-
|
20
|
-
spec.version = WMQ::VERSION
|
21
|
-
spec.platform = Gem::Platform::CURRENT
|
22
|
-
spec.authors = ['Reid Morrison', 'Edwin Fine']
|
23
|
-
spec.email = ['reidmo@gmail.com']
|
24
|
-
spec.homepage = 'https://github.com/reidmorrison/rubywmq'
|
25
|
-
spec.date = Date.today.to_s
|
26
|
-
spec.summary = "Native Ruby interface into WebSphere MQ"
|
27
|
-
spec.description = "RubyWMQ is a high performance native Ruby interface into WebSphere MQ."
|
28
|
-
spec.files = Dir['examples/**/*.rb'] +
|
29
|
-
Dir['examples/**/*.cfg'] +
|
30
|
-
Dir['doc/**/*.*'] +
|
31
|
-
Dir['lib/**/*.rb'] +
|
32
|
-
['lib/wmq/wmq.so', 'tests/test.rb', 'README', 'LICENSE']
|
33
|
-
spec.license = "Apache License V2.0"
|
34
|
-
spec.rubyforge_project = 'rubywmq'
|
35
|
-
spec.test_file = 'tests/test.rb'
|
36
|
-
spec.has_rdoc = false
|
37
|
-
spec.required_ruby_version = '>= 1.8.4'
|
38
|
-
spec.add_development_dependency 'shoulda'
|
39
|
-
spec.requirements << 'WebSphere MQ v5.3, v6 or v7 Client or Server with Development Kit'
|
40
|
-
end
|
41
|
-
Gem::Package.build gemspec
|
6
|
+
task :gem do
|
7
|
+
system 'gem build rubywmq.gemspec'
|
42
8
|
end
|
43
9
|
|
44
|
-
|
10
|
+
task publish: :gem do
|
11
|
+
system "git tag -a v#{WMQ::VERSION} -m 'Tagging #{WMQ::VERSION}'"
|
12
|
+
system 'git push --tags'
|
13
|
+
system "gem push rubywmq-#{WMQ::VERSION}.gem"
|
14
|
+
system "rm rubywmq-#{WMQ::VERSION}.gem"
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Run Test Suite'
|
45
18
|
task :test do
|
46
19
|
Rake::TestTask.new(:functional) do |t|
|
47
|
-
t.test_files = FileList['test
|
20
|
+
t.test_files = FileList['test/**/*_test.rb']
|
48
21
|
t.verbose = true
|
49
22
|
end
|
50
23
|
|
51
24
|
Rake::Task['functional'].invoke
|
52
25
|
end
|
26
|
+
|
27
|
+
task default: :test
|
data/examples/each_a.rb
CHANGED
@@ -3,11 +3,10 @@
|
|
3
3
|
# If no messages are on the queue, the program
|
4
4
|
# completes without waiting
|
5
5
|
#
|
6
|
-
require 'rubygems'
|
7
6
|
require 'wmq'
|
8
7
|
|
9
|
-
WMQ::QueueManager.connect(:
|
10
|
-
qmgr.open_queue(:
|
8
|
+
WMQ::QueueManager.connect(q_mgr_name: 'REID') do |qmgr|
|
9
|
+
qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :input) do |queue|
|
11
10
|
queue.each do |message|
|
12
11
|
puts "Data Received: #{message.data}"
|
13
12
|
end
|
data/examples/each_b.rb
CHANGED
@@ -2,19 +2,18 @@
|
|
2
2
|
# Sample : each() : Retrieve all messages from a queue that
|
3
3
|
# have the same correlation id
|
4
4
|
#
|
5
|
-
require 'rubygems'
|
6
5
|
require 'wmq'
|
7
6
|
|
8
|
-
WMQ::QueueManager.connect(:
|
9
|
-
qmgr.open_queue(:
|
7
|
+
WMQ::QueueManager.connect(q_mgr_name: 'REID') do |qmgr|
|
8
|
+
qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :input) do |queue|
|
10
9
|
message = WMQ::Message.new
|
11
10
|
|
12
11
|
# Retrieve First message
|
13
|
-
if queue.get(:message
|
12
|
+
if queue.get(message: message)
|
14
13
|
puts "Data Received: #{message.data}"
|
15
14
|
|
16
15
|
#Retrieve all subsequent messages that have the same correlation id
|
17
|
-
queue.each(:message
|
16
|
+
queue.each(message: message, match: WMQ::MQMO_MATCH_CORREL_ID) do |msg|
|
18
17
|
puts "Matching Data Received: #{msg.data}"
|
19
18
|
end
|
20
19
|
else
|
data/examples/each_header.rb
CHANGED
@@ -3,19 +3,18 @@
|
|
3
3
|
# If no messages are on the queue, the program
|
4
4
|
# completes without waiting
|
5
5
|
#
|
6
|
-
require 'rubygems'
|
7
6
|
require 'wmq'
|
8
7
|
|
9
|
-
WMQ::QueueManager.connect(:
|
10
|
-
qmgr.open_queue(:
|
8
|
+
WMQ::QueueManager.connect(q_mgr_name: 'REID') do |qmgr|
|
9
|
+
qmgr.open_queue(q_name: 'TEST.DEAD', mode: :browse) do |queue|
|
11
10
|
queue.each do |message|
|
12
11
|
puts "Data Received: #{message.data}"
|
13
12
|
|
14
|
-
puts
|
13
|
+
puts 'Message Descriptor:'
|
15
14
|
p message.descriptor
|
16
15
|
|
17
|
-
puts
|
18
|
-
message.headers.each {|header| p header}
|
16
|
+
puts 'Headers Received:'
|
17
|
+
message.headers.each { |header| p header }
|
19
18
|
end
|
20
19
|
end
|
21
20
|
puts 'Completed.'
|
data/examples/files_to_q.rb
CHANGED
@@ -2,27 +2,26 @@
|
|
2
2
|
# Example : files_to_q : Place all files in a directory to a queue
|
3
3
|
# Each file is written as a separate message
|
4
4
|
#
|
5
|
-
require 'rubygems'
|
6
5
|
require 'find'
|
7
6
|
require 'yaml'
|
8
7
|
require 'wmq'
|
9
8
|
|
10
9
|
# Call program passing environment name as first parameter
|
11
10
|
# The environment corresponds to an entry in the config file
|
12
|
-
env
|
11
|
+
env = ARGV[0] || fail('Command line argument `environment` is required')
|
13
12
|
config = YAML::load_file('files_to_q.cfg')[env]
|
14
13
|
|
15
|
-
message
|
14
|
+
message = WMQ::Message.new
|
16
15
|
message.descriptor = config['descriptor'] || {}
|
17
|
-
tstart
|
18
|
-
counter
|
16
|
+
tstart = Time.now
|
17
|
+
counter = 0
|
19
18
|
WMQ::QueueManager.connect(config['qmgr_options']) do |qmgr|
|
20
|
-
qmgr.open_queue({:
|
19
|
+
qmgr.open_queue({ mode: :output }.merge(config['output_queue'])) do |queue|
|
21
20
|
Find.find(config['source_directory']) do |path|
|
22
21
|
unless FileTest.directory?(path)
|
23
|
-
printf("%5d: #{path}\n",counter = counter + 1)
|
22
|
+
printf("%5d: #{path}\n", counter = counter + 1)
|
24
23
|
message.data = File.read(path)
|
25
|
-
queue.put({:message
|
24
|
+
queue.put({ message: message }.merge(config['put_options']))
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
data/examples/get_a.rb
CHANGED
@@ -2,14 +2,12 @@
|
|
2
2
|
# Sample : get() : Retrieve a single message from a queue
|
3
3
|
# If no messages are on the queue, message.data is nil
|
4
4
|
#
|
5
|
-
require 'rubygems'
|
6
5
|
require 'wmq'
|
7
6
|
|
8
|
-
WMQ::QueueManager.connect(:
|
9
|
-
qmgr.open_queue(:
|
10
|
-
|
7
|
+
WMQ::QueueManager.connect(q_mgr_name: 'REID') do |qmgr|
|
8
|
+
qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :input) do |queue|
|
11
9
|
message = WMQ::Message.new
|
12
|
-
if queue.get(:
|
10
|
+
if queue.get(message: message)
|
13
11
|
puts "Data Received: #{message.data}"
|
14
12
|
else
|
15
13
|
puts 'No message available'
|
data/examples/get_client.rb
CHANGED
@@ -8,25 +8,24 @@
|
|
8
8
|
# If :connection_name is not present, a WebSphere MQ Server connection will be used
|
9
9
|
# I.e. Local server connection
|
10
10
|
#
|
11
|
-
require 'rubygems'
|
12
11
|
require 'wmq'
|
13
12
|
|
14
13
|
WMQ::QueueManager.connect(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
qmgr.open_queue(:
|
14
|
+
connection_name: 'localhost(1414)', # Use MQ Client Library
|
15
|
+
channel_name: 'SYSTEM.DEF.SVRCONN', # Optional, since this is the default value
|
16
|
+
transport_type: WMQ::MQXPT_TCP # Optional, since this is the default value
|
17
|
+
) do |qmgr|
|
18
|
+
qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :input) do |queue|
|
20
19
|
|
21
20
|
message = WMQ::Message.new
|
22
|
-
if queue.get(:
|
21
|
+
if queue.get(message: message)
|
23
22
|
puts "Data Received: #{message.data}"
|
24
23
|
|
25
|
-
puts
|
24
|
+
puts 'Message Descriptor:'
|
26
25
|
p message.descriptor
|
27
26
|
|
28
|
-
puts
|
29
|
-
message.headers.each {|header| p header}
|
27
|
+
puts 'Headers Received:'
|
28
|
+
message.headers.each { |header| p header }
|
30
29
|
else
|
31
30
|
puts 'No message available'
|
32
31
|
end
|