ferocia-rubywmq 1.1.3 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.document +0 -4
  2. data/LICENSE.txt +201 -0
  3. data/README.md +408 -0
  4. data/Rakefile +91 -0
  5. data/examples/each_a.rb +1 -17
  6. data/examples/each_b.rb +1 -17
  7. data/examples/each_header.rb +3 -19
  8. data/examples/files_to_q.rb +1 -17
  9. data/examples/get_a.rb +1 -17
  10. data/examples/get_client.rb +5 -21
  11. data/examples/put1_a.rb +1 -17
  12. data/examples/put1_b.rb +1 -17
  13. data/examples/put1_c.rb +3 -19
  14. data/examples/put_a.rb +1 -17
  15. data/examples/put_b.rb +1 -17
  16. data/examples/put_dlh.rb +4 -20
  17. data/examples/put_dynamic_q.rb +1 -17
  18. data/examples/put_group_a.rb +1 -17
  19. data/examples/put_group_b.rb +1 -17
  20. data/examples/put_rfh.rb +12 -28
  21. data/examples/put_rfh2_a.rb +5 -21
  22. data/examples/put_rfh2_b.rb +5 -21
  23. data/examples/put_xmit_q.rb +2 -18
  24. data/examples/q_to_files.rb +1 -17
  25. data/examples/request.rb +7 -23
  26. data/examples/server.rb +10 -26
  27. data/ext/extconf.rb +26 -46
  28. data/ext/extconf_client.rb +3 -19
  29. data/ext/generate/generate_const.rb +16 -43
  30. data/ext/generate/generate_reason.rb +23 -36
  31. data/ext/generate/generate_structs.rb +7 -22
  32. data/ext/generate/wmq_structs.erb +28 -58
  33. data/ext/wmq.c +1 -4
  34. data/ext/wmq.h +5 -1
  35. data/ext/wmq_message.c +1 -1
  36. data/ext/wmq_mq_load.c +1 -1
  37. data/ext/wmq_queue.c +1 -1
  38. data/ext/wmq_queue_manager.c +3 -3
  39. data/lib/rubywmq.rb +1 -0
  40. data/lib/wmq.rb +13 -26
  41. data/lib/wmq/message.rb +70 -0
  42. data/{ext/lib/wmq_temp.rb → lib/wmq/queue_manager.rb} +11 -98
  43. data/lib/wmq/version.rb +3 -0
  44. data/tests/test.rb +30 -40
  45. metadata +10 -20
  46. data/LICENSE +0 -13
  47. data/Manifest.txt +0 -20
  48. data/README +0 -73
  49. data/ext/build.bat +0 -3
  50. data/ext/build.sh +0 -6
  51. data/rubywmq.binary.gemspec +0 -32
  52. data/rubywmq.gemspec +0 -33
data/Rakefile ADDED
@@ -0,0 +1,91 @@
1
+ lib = File.expand_path('../lib/', __FILE__)
2
+ $:.unshift lib unless $:.include?(lib)
3
+
4
+ require 'rubygems'
5
+ require 'rubygems/package'
6
+ require 'rake/clean'
7
+ require 'rake/testtask'
8
+ require 'date'
9
+ require 'wmq/version'
10
+
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
+ ]
25
+
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
48
+ end
49
+
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
81
+ end
82
+
83
+ desc "Run Test Suite"
84
+ task :test do
85
+ Rake::TestTask.new(:functional) do |t|
86
+ t.test_files = FileList['test/*_test.rb']
87
+ t.verbose = true
88
+ end
89
+
90
+ Rake::Task['functional'].invoke
91
+ end
data/examples/each_a.rb CHANGED
@@ -1,26 +1,10 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : each() : Retrieve all messages from a queue
19
3
  # If no messages are on the queue, the program
20
4
  # completes without waiting
21
5
  #
22
6
  require 'rubygems'
23
- require 'wmq/wmq'
7
+ require 'wmq'
24
8
 
25
9
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
26
10
  qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:input) do |queue|
data/examples/each_b.rb CHANGED
@@ -1,25 +1,9 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : each() : Retrieve all messages from a queue that
19
3
  # have the same correlation id
20
4
  #
21
5
  require 'rubygems'
22
- require 'wmq/wmq'
6
+ require 'wmq'
23
7
 
24
8
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
25
9
  qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:input) do |queue|
@@ -1,35 +1,19 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : each() : Retrieve all messages from a queue
19
3
  # If no messages are on the queue, the program
20
4
  # completes without waiting
21
5
  #
22
6
  require 'rubygems'
23
- require 'wmq/wmq'
7
+ require 'wmq'
24
8
 
25
9
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
26
10
  qmgr.open_queue(:q_name=>'TEST.DEAD', :mode=>:browse) do |queue|
27
11
  queue.each do |message|
28
12
  puts "Data Received: #{message.data}"
29
-
13
+
30
14
  puts "Message Descriptor:"
31
15
  p message.descriptor
32
-
16
+
33
17
  puts "Headers Received:"
34
18
  message.headers.each {|header| p header}
35
19
  end
@@ -1,19 +1,3 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Example : files_to_q : Place all files in a directory to a queue
19
3
  # Each file is written as a separate message
@@ -21,7 +5,7 @@
21
5
  require 'rubygems'
22
6
  require 'find'
23
7
  require 'yaml'
24
- require 'wmq/wmq'
8
+ require 'wmq'
25
9
 
26
10
  # Call program passing environment name as first parameter
27
11
  # The environment corresponds to an entry in the config file
data/examples/get_a.rb CHANGED
@@ -1,25 +1,9 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : get() : Retrieve a single message from a queue
19
3
  # If no messages are on the queue, message.data is nil
20
4
  #
21
5
  require 'rubygems'
22
- require 'wmq/wmq'
6
+ require 'wmq'
23
7
 
24
8
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
25
9
  qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:input) do |queue|
@@ -1,31 +1,15 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : get() : Retrieve a single message from a queue
19
3
  # If no messages are on the queue, message.data is nil
20
4
  #
21
5
  # The Client connection is determined by the :connection_name parameter supplied
22
6
  # to QueueManager::connect or QueueManager::new
23
- #
7
+ #
24
8
  # If :connection_name is not present, a WebSphere MQ Server connection will be used
25
9
  # I.e. Local server connection
26
- #
10
+ #
27
11
  require 'rubygems'
28
- require 'wmq/wmq'
12
+ require 'wmq'
29
13
 
30
14
  WMQ::QueueManager.connect(
31
15
  :connection_name => 'localhost(1414)', # Use MQ Client Library
@@ -37,10 +21,10 @@ WMQ::QueueManager.connect(
37
21
  message = WMQ::Message.new
38
22
  if queue.get(:message => message)
39
23
  puts "Data Received: #{message.data}"
40
-
24
+
41
25
  puts "Message Descriptor:"
42
26
  p message.descriptor
43
-
27
+
44
28
  puts "Headers Received:"
45
29
  message.headers.each {|header| p header}
46
30
  else
data/examples/put1_a.rb CHANGED
@@ -1,24 +1,8 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : put1() : Put a single message to a queue
19
3
  #
20
4
  require 'rubygems'
21
- require 'wmq/wmq'
5
+ require 'wmq'
22
6
 
23
7
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
24
8
  qmgr.put(:q_name=>'TEST.QUEUE', :data => 'Hello World')
data/examples/put1_b.rb CHANGED
@@ -1,26 +1,10 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : put1() : Put a single message to a queue
19
3
  #
20
4
  # Set the correlation id to a text string
21
5
  #
22
6
  require 'rubygems'
23
- require 'wmq/wmq'
7
+ require 'wmq'
24
8
 
25
9
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
26
10
 
data/examples/put1_c.rb CHANGED
@@ -1,32 +1,16 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : put() : Put a single request message to a queue
19
3
  #
20
4
  require 'rubygems'
21
- require 'wmq/wmq'
5
+ require 'wmq'
22
6
 
23
7
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
24
8
  message = WMQ::Message.new
25
9
  message.data = 'Hello World'
26
-
10
+
27
11
  message.descriptor = {
28
12
  :msg_type=> WMQ::MQMT_REQUEST,
29
13
  :reply_to_q=>'TEST.REPLY.QUEUE'}
30
-
14
+
31
15
  qmgr.put(:q_name=>'TEST.QUEUE', :message => message)
32
16
  end
data/examples/put_a.rb CHANGED
@@ -1,25 +1,9 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : put() : Put a single message to a queue
19
3
  # Open the queue so that multiple puts can be performed
20
4
  #
21
5
  require 'rubygems'
22
- require 'wmq/wmq'
6
+ require 'wmq'
23
7
 
24
8
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
25
9
  qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:output) do |queue|
data/examples/put_b.rb CHANGED
@@ -1,26 +1,10 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : put() : Put two Messages to a queue
19
3
  # Open the queue so that multiple puts can be performed
20
4
  # Ensure that all messages have the same correlation id
21
5
  #
22
6
  require 'rubygems'
23
- require 'wmq/wmq'
7
+ require 'wmq'
24
8
 
25
9
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
26
10
  qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:output) do |queue|
data/examples/put_dlh.rb CHANGED
@@ -1,40 +1,24 @@
1
- ################################################################################
2
- # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #
18
2
  # Sample : put() : Put a message to a queue with a dead letter header
19
3
  # Open the queue so that multiple puts can be performed
20
4
  #
21
5
  require 'rubygems'
22
- require 'wmq/wmq'
6
+ require 'wmq'
23
7
 
24
8
  WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
25
9
  qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:output) do |queue|
26
10
  message = WMQ::Message.new
27
11
  message.data = 'Hello World'
28
-
12
+
29
13
  message.headers = [
30
14
  {:header_type =>:dead_letter_header,
31
15
  :reason => WMQ::MQRC_UNKNOWN_REMOTE_Q_MGR,
32
16
  :dest_q_name =>'ORIGINAL_QUEUE_NAME',
33
17
  :dest_q_mgr_name =>'BAD_Q_MGR'}
34
18
  ]
35
-
19
+
36
20
  message.descriptor[:format] = WMQ::MQFMT_STRING
37
-
21
+
38
22
  queue.put(:message=>message)
39
23
  end
40
24
  end