ferocia-rubywmq 2.0.2 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +10 -0
  3. data/Gemfile.lock +36 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +36 -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 +36 -26
  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 +78 -88
  41. data/lib/wmq.rb +17 -11
  42. data/lib/wmq/message.rb +36 -34
  43. data/lib/wmq/queue_manager.rb +30 -23
  44. data/lib/wmq/version.rb +1 -1
  45. data/rubywmq.gemspec +44 -0
  46. data/test/queue_manager_test.rb +334 -0
  47. data/test/test_helper.rb +14 -0
  48. metadata +23 -34
  49. data/tests/test.rb +0 -318
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 76d55f39d0ec09a6b0f898cf1e895bbd0d16589436d12956316d14f2d9f71a96
4
+ data.tar.gz: 1061d31e119778d01bb74a6b66b31ec045521ecbe9ee99a987a4e2394c832bba
5
+ SHA512:
6
+ metadata.gz: e9226aba45fa69bd693fbec112b6195303c87ebd635c079fcb56cce9f10268c9093314f2f737ec882fde1f2644212a60c28a869def06535f6e829ededb2ac14d
7
+ data.tar.gz: e5f43e9f055c9b3d35d5479c70e554e6267c892ff396adcb7a74ffa1fd9f64c797212823e6d3e6baba729ccbe528e050d714e42bcfb209019f091113c84a8baa
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'
@@ -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
@@ -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,17 +1,24 @@
1
- ## rubywmq
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 2000 messages per second from a Queue
14
- * (Non-persistent messages, < 4K each, MQ V6, running on Windows Laptop)
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, and V7.5
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(:q_mgr_name=>'TEST') do |qmgr|
73
- qmgr.put(:q_name=>'TEST.QUEUE', :data => 'Hello World')
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
- 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
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:\DevKit
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 --platform=ruby
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 env
223
+ gem which rubywmq
214
224
 
215
225
  The path to the rubywmq gem will be something like
216
226
 
217
- C:\Ruby193\lib\ruby\gems\1.9.1\gems\rubywmq-2.0.0\ext
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 connect to both a local
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
- ## Support
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
- 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/).
373
+ This project adheres to [Semantic Versioning](http://semver.org/).
386
374
 
387
375
  ## Author
388
376
 
389
- Reid Morrison :: reidmo@gmail.com :: @reidmorrison
377
+ [Reid Morrison](https://github.com/reidmorrison) :: @reidmorrison
378
+
379
+ ## Contributors
390
380
 
391
- Special thanks to Edwin Fine for the RFH parsing code and for introducing me to
392
- the wonderful world of Ruby
381
+ * Edwin Fine - RFH parsing code
393
382
 
394
383
  ## License
395
384
 
396
- Copyright 2006 - 2012 J. Reid Morrison
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,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 = 'ferocia-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::Builder.new(gemspec).build
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 = 'ferocia-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::Builder.new(gemspec).build
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
@@ -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
@@ -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