rubywmq 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -0
  3. data/Gemfile.lock +37 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +29 -47
  6. data/Rakefile +12 -76
  7. data/examples/each_a.rb +2 -3
  8. data/examples/each_b.rb +4 -5
  9. data/examples/each_header.rb +5 -6
  10. data/examples/files_to_q.rb +7 -8
  11. data/examples/get_a.rb +3 -5
  12. data/examples/get_client.rb +9 -10
  13. data/examples/put1_a.rb +2 -3
  14. data/examples/put1_b.rb +4 -7
  15. data/examples/put1_c.rb +6 -6
  16. data/examples/put_a.rb +0 -2
  17. data/examples/put_b.rb +5 -7
  18. data/examples/put_dlh.rb +11 -12
  19. data/examples/put_dynamic_q.rb +7 -7
  20. data/examples/put_group_a.rb +3 -4
  21. data/examples/put_group_b.rb +7 -7
  22. data/examples/put_rfh.rb +13 -11
  23. data/examples/put_rfh2_a.rb +9 -10
  24. data/examples/put_rfh2_b.rb +9 -9
  25. data/examples/put_xmit_q.rb +63 -8
  26. data/examples/q_to_files.rb +6 -7
  27. data/examples/request.rb +20 -18
  28. data/examples/server.rb +19 -16
  29. data/ext/extconf.rb +2 -1
  30. data/ext/extconf_client.rb +3 -3
  31. data/ext/generate/generate_const.rb +30 -23
  32. data/ext/generate/generate_reason.rb +70 -72
  33. data/ext/generate/generate_structs.rb +20 -19
  34. data/ext/generate/wmq_structs.erb +67 -67
  35. data/ext/wmq.c +0 -16
  36. data/ext/wmq.h +0 -16
  37. data/ext/wmq_message.c +8 -24
  38. data/ext/wmq_mq_load.c +5 -17
  39. data/ext/wmq_queue.c +73 -90
  40. data/ext/wmq_queue_manager.c +115 -108
  41. data/lib/wmq/message.rb +36 -34
  42. data/lib/wmq/queue_manager.rb +22 -19
  43. data/lib/wmq/version.rb +1 -1
  44. data/rubywmq.gemspec +38 -0
  45. data/test/queue_manager_test.rb +334 -0
  46. data/test/test_helper.rb +14 -0
  47. metadata +16 -26
  48. data/tests/test.rb +0 -318
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 834d0740e22c3b3190b212f009b66b4d9edd49ba
4
- data.tar.gz: 33401b505830bc3d54fe6dcc32f4c1002b765cfe
3
+ metadata.gz: b802e25f55b180913d83383fa1677fde31a954c3
4
+ data.tar.gz: 366ed87e4148c86ba88e4fea59145335c089aa98
5
5
  SHA512:
6
- metadata.gz: 88e4d7a3df579cd225328b8f1835d323e35aa160d142d36265ae26a1918a3c3007421e470adcb2a40bfffd27b7218e75bb2fc50fa51e8dce7981fdcc12645c5b
7
- data.tar.gz: 51e22dd147c46b90975cd3de53e10ea29045afeb26beb81e1329f0e8a4fe42aafbf597f858d6cf8466a5b38f48f890854e81227500396575c9e40605af6cc057
6
+ metadata.gz: cef09bb323a8a79f7aa6cc2e79dd8240419c94589d02b59bfe7b1859d398bef6c1b1d3afe0a19e0088588d1a2a2ac4c18a8260d32743cfad5484dbbbec11b023
7
+ data.tar.gz: 2d5747bafe54f8700e1ba61ec5a6a64cfa5cb412f78e387fa89551ed162bdd494cb826c556804b0a735c67045d4e1014207ad491fb75eb989659089f79ac73e0
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'rake'
6
+ gem 'minitest'
7
+ gem 'minitest-reporters'
8
+ gem 'minitest-stub_any_instance'
9
+ gem 'shoulda-context'
10
+ gem 'awesome_print'
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: /
3
+ specs:
4
+ rubywmq (2.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ansi (1.5.0)
10
+ awesome_print (1.6.1)
11
+ builder (3.2.2)
12
+ minitest (5.7.0)
13
+ minitest-reporters (1.0.19)
14
+ ansi
15
+ builder
16
+ minitest (>= 5.0)
17
+ ruby-progressbar
18
+ minitest-stub_any_instance (1.0.1)
19
+ rake (10.4.2)
20
+ ruby-progressbar (1.7.5)
21
+ shoulda-context (1.2.1)
22
+
23
+ PLATFORMS
24
+ ruby
25
+ x64-mingw32
26
+
27
+ DEPENDENCIES
28
+ awesome_print
29
+ minitest
30
+ minitest-reporters
31
+ minitest-stub_any_instance
32
+ rake
33
+ rubywmq!
34
+ shoulda-context
35
+
36
+ BUNDLED WITH
37
+ 1.10.6
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 - 2012 J. Reid Morrison
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,4 +1,4 @@
1
- ## rubywmq
1
+ # rubywmq
2
2
 
3
3
  RubyWMQ is a high performance native Ruby interface into WebSphere MQ.
4
4
 
@@ -10,8 +10,8 @@ The Ruby WMQ interface currently supports the following features:
10
10
 
11
11
  High performance
12
12
 
13
- * Able to read over 2000 messages per second from a Queue
14
- * (Non-persistent messages, < 4K each, MQ V6, running on Windows Laptop)
13
+ * Able to read over 2,000 messages per second from a Queue
14
+ * Non-persistent messages, < 4K each, MQ V6
15
15
 
16
16
  Full support for the entire MQ Administration interface (MQAI)
17
17
 
@@ -44,16 +44,14 @@ Single Ruby WMQ auto-detection library that concurrently supports:
44
44
 
45
45
  Includes latest client connection options such as SSL
46
46
 
47
- Tested with WebSphere MQ V5.3, V6, V7, and V7.5
47
+ Tested with WebSphere MQ V5.3, V6, V7, V7.5, and V8
48
48
 
49
49
  Is written in C to ensure easier portability and performance
50
50
 
51
51
  ### Compatibility
52
52
 
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
53
+ * Ruby 1.9 or greater
54
+ * Not designed for JRuby, use (jruby-jms)[https://github.com/reidmorrison/jruby-jms]
57
55
 
58
56
  WebSphere MQ
59
57
 
@@ -64,21 +62,18 @@ WebSphere MQ
64
62
  ## Example
65
63
 
66
64
  ```ruby
67
- require 'rubygems'
68
65
  require 'wmq'
69
66
 
70
67
  # Connect to a local queue manager called 'TEST' and put a single message
71
68
  # on the queue 'TEST.QUEUE'
72
- WMQ::QueueManager.connect(:q_mgr_name=>'TEST') do |qmgr|
73
- qmgr.put(:q_name=>'TEST.QUEUE', :data => 'Hello World')
69
+ WMQ::QueueManager.connect(q_mgr_name: 'TEST') do |qmgr|
70
+ qmgr.put(q_name: 'TEST.QUEUE', data: 'Hello World')
74
71
  end
75
72
  ```
76
73
 
77
74
  ## More Examples
78
75
 
79
- There are many examples covering many of the ways that RubyWMQ can be used. The examples
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
76
+ The examples below are all available at https://github.com/reidmorrison/rubywmq/tree/master/examples
82
77
 
83
78
  Put one message to a Queue (Without opening the queue)
84
79
 
@@ -149,6 +144,8 @@ Also install RubyGems and ruby-dev or ruby-sdk packages if not already installed
149
144
 
150
145
  Install the [WebSphere MQ Client and/or Server](http://www.ibm.com/developerworks/downloads/ws/wmq/)
151
146
 
147
+ * 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!
148
+
152
149
  * Note: Install the Development Toolkit (SDK) and Client
153
150
 
154
151
  Install RubyWMQ Gem
@@ -186,7 +183,7 @@ Download and install the Ruby installer from http://rubyinstaller.org/downloads/
186
183
 
187
184
  Download and install the Development Kit from the same site
188
185
 
189
- * Extract files into c:\DevKit
186
+ * Extract files into c:\Devkit
190
187
 
191
188
  Open a command prompt and run the commands below:
192
189
 
@@ -199,22 +196,28 @@ If you experience any difficulties, see https://github.com/oneclick/rubyinsta
199
196
 
200
197
  Install the [WebSphere MQ Client and/or Server](http://www.ibm.com/developerworks/downloads/ws/wmq/)
201
198
 
199
+ * 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!
200
+
202
201
  * Note: Install the Development Toolkit (SDK) and Client
203
202
 
204
203
  #### Install the RubyWMQ Gem
205
204
 
206
205
  call "c:\DevKit\devkitvars.bat"
207
- gem install rubywmq --platform=ruby
206
+ gem install rubywmq
207
+
208
+ If WebSphere MQ is installed in the non-default location:
209
+
210
+ gem install rubywmq --platform=ruby -- '--with-mqm-include="C:\Program Files\IBM\WebSphere MQ\Tools\c\include"'
208
211
 
209
212
  #### Installation Errors
210
213
 
211
214
  Use this command to find the directory in which the gems are installed
212
215
 
213
- gem env
216
+ gem which rubywmq
214
217
 
215
218
  The path to the rubywmq gem will be something like
216
219
 
217
- C:\Ruby193\lib\ruby\gems\1.9.1\gems\rubywmq-2.0.0\ext
220
+ C:\Ruby22\lib\ruby\gems\2.2.0\gems\rubywmq-2.0.3\ext
218
221
 
219
222
  When WebSphere MQ is not installed in the default location, change to the directory
220
223
  above and call the build command directly while supplying the location explicitly:
@@ -235,7 +238,6 @@ Create a local queue called TEST.QUEUE
235
238
  Run the following Ruby Code in an irb session:
236
239
 
237
240
  ```ruby
238
- require 'rubygems'
239
241
  require 'wmq'
240
242
  WMQ::QueueManager.connect(:q_mgr_name=>'TEST') do |qmgr|
241
243
  qmgr.put(:q_name=>'TEST.QUEUE', :data => 'Hello World')
@@ -256,7 +258,7 @@ is installed locally. This prevents issues with having to statically link with
256
258
  both the client and server libraries and then having to select the "correct"
257
259
  one on startup.
258
260
 
259
- Additionally, this approach allows RubyWMQ to be simultaneously connect to both a local
261
+ Additionally, this approach allows RubyWMQ to be simultaneously connected to a local
260
262
  Queue Manager via server bindings and to a remote Queue Manager using Client bindings.
261
263
 
262
264
  Instead of hard coding all the MQ C Structures and return codes into RubyWMQ, it
@@ -359,41 +361,21 @@ dis channel(*) chltype(SVRCONN)
359
361
  * Look for the channel name the application is using.
360
362
  * Note: the channel name is case-sensitive.
361
363
 
362
- ## Support
364
+ ## Versioning
363
365
 
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
-
372
- 1. [Fork](http://help.github.com/forking/) rubywmq
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/).
366
+ This project adheres to [Semantic Versioning](http://semver.org/).
386
367
 
387
368
  ## Author
388
369
 
389
- Reid Morrison :: reidmo@gmail.com :: @reidmorrison
370
+ [Reid Morrison](https://github.com/reidmorrison) :: @reidmorrison
371
+
372
+ ## Contributors
390
373
 
391
- Special thanks to Edwin Fine for the RFH parsing code and for introducing me to
392
- the wonderful world of Ruby
374
+ * Edwin Fine - RFH parsing code
393
375
 
394
376
  ## License
395
377
 
396
- Copyright 2006 - 2012 J. Reid Morrison
378
+ Copyright 2006 - 2015 J. Reid Morrison
397
379
 
398
380
  Licensed under the Apache License, Version 2.0 (the "License");
399
381
  you may not use this file except in compliance with the License.
data/Rakefile CHANGED
@@ -1,91 +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
- desc "Build Ruby Source gem"
12
- task :gem do |t|
13
- excludes = [
14
- /lib.wmq.constants\.rb/,
15
- /lib.wmq.constants_admin\.rb/,
16
- /ext.wmq_structs\.c/,
17
- /ext.wmq_reason\.c/,
18
- /ext.Makefile/,
19
- /ext.*\.o/,
20
- /ext.wmq\.so/,
21
- /\.gem$/,
22
- /\.log$/,
23
- /nbproject/
24
- ]
4
+ require_relative 'lib/wmq/version'
25
5
 
26
- gemspec = Gem::Specification.new do |spec|
27
- spec.name = 'rubywmq'
28
- spec.version = WMQ::VERSION
29
- spec.platform = Gem::Platform::RUBY
30
- spec.authors = ['Reid Morrison', 'Edwin Fine']
31
- spec.email = ['reidmo@gmail.com']
32
- spec.homepage = 'https://github.com/reidmorrison/rubywmq'
33
- spec.date = Date.today.to_s
34
- spec.summary = "Native Ruby interface into WebSphere MQ"
35
- spec.description = "RubyWMQ is a high performance native Ruby interface into WebSphere MQ."
36
- spec.files = FileList["./**/*"].exclude(*excludes).map{|f| f.sub(/^\.\//, '')} + ['.document']
37
- spec.license = "Apache License V2.0"
38
- spec.extensions << 'ext/extconf.rb'
39
- spec.rubyforge_project = 'rubywmq'
40
- spec.test_file = 'tests/test.rb'
41
- spec.has_rdoc = true
42
- spec.required_ruby_version = '>= 1.8.4'
43
- spec.add_development_dependency 'shoulda'
44
- spec.requirements << 'WebSphere MQ v5.3, v6 or v7 Client or Server with Development Kit'
45
- end
46
- p gemspec.files
47
- Gem::Package.build gemspec
6
+ task :gem do
7
+ system 'gem build rubywmq.gemspec'
48
8
  end
49
9
 
50
- desc "Build a binary gem including pre-compiled binary files for re-distribution"
51
- task :binary do |t|
52
- # Move compiled files into locations for repackaging as a binary gem
53
- FileUtils.mkdir_p('lib/wmq')
54
- Dir['ext/lib/*.rb'].each{|file| FileUtils.copy(file, File.join('lib/wmq', File.basename(file)))}
55
- FileUtils.copy('ext/wmq.so', 'lib/wmq/wmq.so')
56
-
57
- gemspec = Gem::Specification.new do |spec|
58
- spec.name = 'rubywmq'
59
- spec.version = WMQ::VERSION
60
- spec.platform = Gem::Platform::CURRENT
61
- spec.authors = ['Reid Morrison', 'Edwin Fine']
62
- spec.email = ['reidmo@gmail.com']
63
- spec.homepage = 'https://github.com/reidmorrison/rubywmq'
64
- spec.date = Date.today.to_s
65
- spec.summary = "Native Ruby interface into WebSphere MQ"
66
- spec.description = "RubyWMQ is a high performance native Ruby interface into WebSphere MQ."
67
- spec.files = Dir['examples/**/*.rb'] +
68
- Dir['examples/**/*.cfg'] +
69
- Dir['doc/**/*.*'] +
70
- Dir['lib/**/*.rb'] +
71
- ['lib/wmq/wmq.so', 'tests/test.rb', 'README', 'LICENSE']
72
- spec.license = "Apache License V2.0"
73
- spec.rubyforge_project = 'rubywmq'
74
- spec.test_file = 'tests/test.rb'
75
- spec.has_rdoc = false
76
- spec.required_ruby_version = '>= 1.8.4'
77
- spec.add_development_dependency 'shoulda'
78
- spec.requirements << 'WebSphere MQ v5.3, v6 or v7 Client or Server with Development Kit'
79
- end
80
- Gem::Package.build gemspec
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"
81
15
  end
82
16
 
83
- desc "Run Test Suite"
17
+ desc 'Run Test Suite'
84
18
  task :test do
85
19
  Rake::TestTask.new(:functional) do |t|
86
- t.test_files = FileList['test/*_test.rb']
20
+ t.test_files = FileList['test/**/*_test.rb']
87
21
  t.verbose = true
88
22
  end
89
23
 
90
24
  Rake::Task['functional'].invoke
91
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(:q_mgr_name=>'REID') do |qmgr|
10
- qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:input) do |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(:q_mgr_name=>'REID') do |qmgr|
9
- qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:input) do |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=>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=>message, :match=>WMQ::MQMO_MATCH_CORREL_ID) do |msg|
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
@@ -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(:q_mgr_name=>'REID') do |qmgr|
10
- qmgr.open_queue(:q_name=>'TEST.DEAD', :mode=>:browse) do |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 "Message Descriptor:"
13
+ puts 'Message Descriptor:'
15
14
  p message.descriptor
16
15
 
17
- puts "Headers Received:"
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.'
@@ -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 = ARGV[0] || raise("Command line argument 'environment' is required")
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 = WMQ::Message.new
14
+ message = WMQ::Message.new
16
15
  message.descriptor = config['descriptor'] || {}
17
- tstart = Time.now
18
- counter = 0
16
+ tstart = Time.now
17
+ counter = 0
19
18
  WMQ::QueueManager.connect(config['qmgr_options']) do |qmgr|
20
- qmgr.open_queue({:mode=>:output}.merge(config['output_queue'])) do |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 => message}.merge(config['put_options']))
24
+ queue.put({ message: message }.merge(config['put_options']))
26
25
  end
27
26
  end
28
27
  end