ferocia-rubywmq 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +8 -0
- data/LICENSE +13 -0
- data/Manifest.txt +20 -0
- data/README +73 -0
- data/examples/each_a.rb +32 -0
- data/examples/each_b.rb +41 -0
- data/examples/each_header.rb +38 -0
- data/examples/files_to_q.cfg +24 -0
- data/examples/files_to_q.rb +47 -0
- data/examples/get_a.rb +35 -0
- data/examples/get_client.rb +51 -0
- data/examples/put1_a.rb +25 -0
- data/examples/put1_b.rb +33 -0
- data/examples/put1_c.rb +32 -0
- data/examples/put_a.rb +35 -0
- data/examples/put_b.rb +43 -0
- data/examples/put_dlh.rb +41 -0
- data/examples/put_dynamic_q.rb +38 -0
- data/examples/put_group_a.rb +51 -0
- data/examples/put_group_b.rb +53 -0
- data/examples/put_rfh.rb +67 -0
- data/examples/put_rfh2_a.rb +43 -0
- data/examples/put_rfh2_b.rb +43 -0
- data/examples/put_xmit_q.rb +33 -0
- data/examples/q_to_files.cfg +17 -0
- data/examples/q_to_files.rb +48 -0
- data/examples/request.rb +60 -0
- data/examples/server.rb +97 -0
- data/ext/build.bat +3 -0
- data/ext/build.sh +6 -0
- data/ext/decode_rfh.c +348 -0
- data/ext/decode_rfh.h +45 -0
- data/ext/extconf.rb +44 -0
- data/ext/extconf_client.rb +40 -0
- data/ext/generate/generate_const.rb +167 -0
- data/ext/generate/generate_reason.rb +246 -0
- data/ext/generate/generate_structs.rb +97 -0
- data/ext/generate/wmq_structs.erb +371 -0
- data/ext/lib/wmq_temp.rb +197 -0
- data/ext/wmq.c +93 -0
- data/ext/wmq.h +367 -0
- data/ext/wmq_message.c +671 -0
- data/ext/wmq_mq_load.c +217 -0
- data/ext/wmq_queue.c +1411 -0
- data/ext/wmq_queue_manager.c +1587 -0
- data/lib/wmq.rb +25 -0
- data/rubywmq.binary.gemspec +32 -0
- data/rubywmq.gemspec +33 -0
- data/tests/test.rb +328 -0
- metadata +124 -0
data/lib/wmq.rb
ADDED
@@ -0,0 +1,25 @@
|
|
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
|
+
# Load wmq that uses auto-load library.
|
18
|
+
#
|
19
|
+
# If it fails, then it is likely due to this platform not being supported
|
20
|
+
# by auto load facility in Ruby WMQ, so try to load client linked library
|
21
|
+
begin
|
22
|
+
require 'wmq/wmq'
|
23
|
+
rescue LoadError
|
24
|
+
require 'wmq/wmq_client'
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
if $0 == __FILE__
|
5
|
+
FileUtils.mkdir_p('lib/wmq')
|
6
|
+
Dir['ext/lib/*.rb'].each{|file| FileUtils.copy(file, File.join('lib/wmq', File.basename(file)))}
|
7
|
+
FileUtils.copy('ext/wmq.so', 'lib/wmq/wmq.so')
|
8
|
+
end
|
9
|
+
|
10
|
+
spec = Gem::Specification.new do |s|
|
11
|
+
s.name = 'rubywmq'
|
12
|
+
s.version = '1.1.0'
|
13
|
+
s.author = 'Reid Morrison'
|
14
|
+
s.email = 'rubywmq@gmail.com'
|
15
|
+
s.homepage = 'http://www.reidmorrison.com/rubywmq'
|
16
|
+
s.platform = Gem::Platform::CURRENT
|
17
|
+
s.summary = 'Ruby interface into WebSphere MQ (MQSeries)'
|
18
|
+
s.description = 'RubyWMQ is a Ruby interface into WebSphere MQ, previously called MQSeries'
|
19
|
+
s.files = Dir['examples/**/*.rb'] +
|
20
|
+
Dir['examples/**/*.cfg'] +
|
21
|
+
Dir['doc/**/*.*'] +
|
22
|
+
Dir['lib/**/*.rb'] +
|
23
|
+
['lib/wmq/wmq.so', 'tests/test.rb', 'README', 'LICENSE']
|
24
|
+
s.rubyforge_project = 'rubywmq'
|
25
|
+
s.test_file = 'tests/test.rb'
|
26
|
+
s.has_rdoc = false
|
27
|
+
s.required_ruby_version = '>= 1.8.3'
|
28
|
+
s.requirements << 'WebSphere MQ v5.3, v6 or v7 Client or Server'
|
29
|
+
end
|
30
|
+
if $0 == __FILE__
|
31
|
+
Gem::Builder.new(spec).build
|
32
|
+
end
|
data/rubywmq.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
|
5
|
+
excludes = [/lib.wmq.constants\.rb/, /lib.wmq.constants_admin\.rb/, /ext.wmq_structs\.c/, /ext.wmq_reason\.c/, /ext.Makefile/, /ext.*\.o/, /ext.wmq\.so/, /\.gem$/, /\.log$/, /nbproject/]
|
6
|
+
|
7
|
+
spec.name = 'ferocia-rubywmq'
|
8
|
+
spec.version = "1.1.0"
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.authors = ['Reid Morrison', 'Edwin Fine']
|
11
|
+
spec.email = ['reidmo@gmail.com']
|
12
|
+
spec.homepage = 'https://github.com/reidmorrison/rubywmq'
|
13
|
+
spec.date = Date.today.to_s
|
14
|
+
spec.summary = "Native Ruby interface into WebSphere MQ"
|
15
|
+
spec.description = "RubyWMQ is a high performance native Ruby interface into WebSphere MQ."
|
16
|
+
spec.files = Dir.glob("./**/*").reject {|p| excludes.any? {|e| p[e] } }.map {|f| f.sub(/^\.\//, '')} + ['.document']
|
17
|
+
spec.license = "Apache License V2.0"
|
18
|
+
spec.extensions << 'ext/extconf.rb'
|
19
|
+
spec.rubyforge_project = 'rubywmq'
|
20
|
+
spec.test_file = 'tests/test.rb'
|
21
|
+
spec.has_rdoc = true
|
22
|
+
spec.required_ruby_version = '>= 1.8.4'
|
23
|
+
spec.add_development_dependency 'shoulda'
|
24
|
+
spec.requirements << 'WebSphere MQ v5.3, v6 or v7 Client or Server with Development Kit'
|
25
|
+
|
26
|
+
spec.post_install_message = <<-MESSAGE
|
27
|
+
* ferocia-rubywmq builds against the WMQ libs, which aren't available for OS X.
|
28
|
+
* The gem will still install, but the build will be skipped, producing a
|
29
|
+
* non-functional gem, so you'll need stubs. (You can skip the build elsewhere by
|
30
|
+
* setting the DISABLE_RUBYWMQ environment variable.)
|
31
|
+
MESSAGE
|
32
|
+
end
|
33
|
+
|
data/tests/test.rb
ADDED
@@ -0,0 +1,328 @@
|
|
1
|
+
# Shift include path to use locally built copy of rubywmq - For testing dev builds only
|
2
|
+
#$:.unshift '../lib'
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'wmq/wmq'
|
6
|
+
require 'wmq/wmq_const_admin'
|
7
|
+
require 'test/unit'
|
8
|
+
class TestTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def setup
|
11
|
+
puts '****** setup: start ******'
|
12
|
+
@queue_manager = WMQ::QueueManager.new(:q_mgr_name => 'REID') #, :connection_name=>'localhost(1414)')
|
13
|
+
@queue_manager.connect
|
14
|
+
|
15
|
+
# Create Queue and clear any messages from the queue
|
16
|
+
@in_queue = WMQ::Queue.new(:queue_manager=>@queue_manager,
|
17
|
+
:mode=>:input,
|
18
|
+
:dynamic_q_name=>'UNIT.TEST.*',
|
19
|
+
:q_name=>'SYSTEM.DEFAULT.MODEL.QUEUE',
|
20
|
+
:fail_if_exists=>false)
|
21
|
+
@in_queue.open
|
22
|
+
@in_queue.each { |message| }
|
23
|
+
|
24
|
+
# Open same queue for Output. Queue should be created by now
|
25
|
+
@out_queue = WMQ::Queue.new(:queue_manager=>@queue_manager,
|
26
|
+
:mode=>:output,
|
27
|
+
:q_name=>@in_queue.name)
|
28
|
+
@out_queue.open
|
29
|
+
puts '****** setup: end ******'
|
30
|
+
end
|
31
|
+
|
32
|
+
def teardown
|
33
|
+
puts '****** teardown: start ******'
|
34
|
+
@out_queue.close
|
35
|
+
@in_queue.close
|
36
|
+
@queue_manager.disconnect
|
37
|
+
puts '****** teardown: end ******'
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_exceptions
|
41
|
+
puts '****** test_exceptions: start ******'
|
42
|
+
assert_raise(TypeError) { WMQ::QueueManager.new(1) }
|
43
|
+
assert_nothing_raised { WMQ::QueueManager.new(:exception_on_error=>nil) }
|
44
|
+
assert_raise(TypeError) { WMQ::QueueManager.new(:exception_on_error=>1) }
|
45
|
+
assert_raise(TypeError) { WMQ::QueueManager.new(:q_mgr_name=>2).connect }
|
46
|
+
assert_raise(WMQ::WMQException) { WMQ::QueueManager.new(:q_mgr_name=>'bad').connect }
|
47
|
+
puts '****** test_exceptions: end ******'
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_queue_manager
|
51
|
+
puts '****** test_queue_manager ******'
|
52
|
+
assert_equal(Object, WMQ::QueueManager.superclass)
|
53
|
+
assert_equal(WMQ::QueueManager, @queue_manager.class)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_1
|
57
|
+
puts '****** test_1 ******'
|
58
|
+
assert_equal(@out_queue.put(:data=>'Hello World'), true)
|
59
|
+
message = WMQ::Message.new
|
60
|
+
assert_equal(@in_queue.get(:message=>message), true)
|
61
|
+
assert_equal(message.data, 'Hello World')
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_dynamic_buffer
|
65
|
+
puts '****** test_dynamic_buffer ******'
|
66
|
+
# Clear out queue of any messages
|
67
|
+
@in_queue.each { |message| }
|
68
|
+
|
69
|
+
test_sizes = [0, 1, 100, 101, 102, 500, 65534, 65535, 65536, 65537, 1*1024*1024, 4*1024*1024]
|
70
|
+
test_sizes.each do |size|
|
71
|
+
str = '0123456789ABCDEF' * (size/16) + '0123456789ABCDEF'[0,size%16]
|
72
|
+
assert_equal(str.length, size)
|
73
|
+
assert_equal(@out_queue.put(:data=>str), true)
|
74
|
+
end
|
75
|
+
|
76
|
+
# First test the browse mechanism
|
77
|
+
counter = 0
|
78
|
+
@queue_manager.open_queue(:mode=>:browse, :q_name=>@in_queue.name) do |browse_queue|
|
79
|
+
browse_queue.each do |message|
|
80
|
+
size = test_sizes[counter]
|
81
|
+
assert_equal(size, message.data.length)
|
82
|
+
str = '0123456789ABCDEF' * (size/16) + '0123456789ABCDEF'[0,size%16]
|
83
|
+
assert_equal(str, message.data)
|
84
|
+
counter = counter + 1
|
85
|
+
end
|
86
|
+
end
|
87
|
+
assert_equal(test_sizes.size, counter)
|
88
|
+
|
89
|
+
# Now retrieve the messages destructively
|
90
|
+
message = WMQ::Message.new
|
91
|
+
test_sizes.each do |size|
|
92
|
+
assert_equal(true, @in_queue.get(:message=>message, :match=>WMQ::MQMO_NONE))
|
93
|
+
assert_equal(size, message.data.length)
|
94
|
+
str = '0123456789ABCDEF' * (size/16) + '0123456789ABCDEF'[0,size%16]
|
95
|
+
assert_equal(str, message.data)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_q_name_hash
|
100
|
+
puts '****** test_q_name_hash ******'
|
101
|
+
@queue_manager.open_queue(:mode=>:output,
|
102
|
+
:q_name=>{:q_name=>@in_queue.name,
|
103
|
+
:q_mgr_name=>@queue_manager.name}
|
104
|
+
) do |test_queue|
|
105
|
+
assert_equal(true, test_queue.put(:data=>'Hello World'))
|
106
|
+
message = WMQ::Message.new
|
107
|
+
assert_equal(true, @in_queue.get(:message=>message))
|
108
|
+
assert_equal('Hello World', message.data)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_execute
|
113
|
+
puts '****** test_execute ******'
|
114
|
+
array = @queue_manager.inquire_q(:q_name=>@in_queue.name, :q_type=>WMQ::MQQT_LOCAL, :current_q_depth=>nil)
|
115
|
+
assert_equal(1, array.size)
|
116
|
+
assert_equal(@in_queue.name, array[0][:q_name])
|
117
|
+
|
118
|
+
assert_equal(true, @queue_manager.inquire_process(:process_name=>'*').size>0)
|
119
|
+
assert_raise(WMQ::WMQException) { @queue_manager.inquire_q(:q_name=>'BADQUEUENAME*') }
|
120
|
+
assert_equal(1, @queue_manager.ping_q_mgr.size)
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_mqsc
|
124
|
+
puts '****** test_mqsc ******'
|
125
|
+
array = @queue_manager.mqsc("dis ql(#{@in_queue.name})")
|
126
|
+
assert_equal(1, array.size)
|
127
|
+
assert_equal(true, array[0].include?("QUEUE(#{@in_queue.name})"))
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_put1
|
131
|
+
puts '****** test_put1 ******'
|
132
|
+
data = 'Some Test Data'
|
133
|
+
assert_equal(true,@queue_manager.put(:q_name=>@in_queue.name, :data=>data))
|
134
|
+
|
135
|
+
message = WMQ::Message.new
|
136
|
+
assert_equal(true, @in_queue.get(:message=>message))
|
137
|
+
assert_equal(data, message.data)
|
138
|
+
end
|
139
|
+
|
140
|
+
def verify_header(header, format)
|
141
|
+
verify_multiple_headers([header], format)
|
142
|
+
end
|
143
|
+
|
144
|
+
def verify_multiple_headers(headers, format)
|
145
|
+
data = 'Some Test Data'
|
146
|
+
message = WMQ::Message.new
|
147
|
+
message.data = data
|
148
|
+
message.descriptor[:format] = format
|
149
|
+
message.headers = headers
|
150
|
+
#assert_equal(true,@queue_manager.put(:q_name=>@in_queue.name, :message=>message))
|
151
|
+
assert_equal(true,@out_queue.put(:message=>message))
|
152
|
+
|
153
|
+
message = WMQ::Message.new
|
154
|
+
assert_equal(true, @in_queue.get(:message=>message))
|
155
|
+
assert_equal(data, message.data)
|
156
|
+
assert_equal(headers.size, message.headers.size)
|
157
|
+
count = 0
|
158
|
+
headers.each do |header|
|
159
|
+
reply_header = message.headers[count]
|
160
|
+
header.each_pair{|key, value| assert_equal(value, reply_header[key])}
|
161
|
+
count = count + 1
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_dlh
|
166
|
+
puts '****** test_dlh ******'
|
167
|
+
dlh = {:header_type =>:dead_letter_header,
|
168
|
+
:reason => WMQ::MQRC_UNKNOWN_REMOTE_Q_MGR,
|
169
|
+
:dest_q_name =>'ORIGINAL_QUEUE_NAME',
|
170
|
+
:dest_q_mgr_name =>'BAD_Q_MGR',
|
171
|
+
:put_appl_name =>'TestApp.exe',
|
172
|
+
}
|
173
|
+
|
174
|
+
verify_header(dlh, WMQ::MQFMT_DEAD_LETTER_HEADER)
|
175
|
+
# Untested keys:
|
176
|
+
#:put_date=>"",
|
177
|
+
#:put_time=>"",
|
178
|
+
#:encoding=>0,
|
179
|
+
#:coded_char_set_id=>437,
|
180
|
+
#:put_appl_type=>0,
|
181
|
+
|
182
|
+
# Test again, but use QueueManager#put this time
|
183
|
+
data = 'Some Test Data'
|
184
|
+
message = WMQ::Message.new
|
185
|
+
message.data = data
|
186
|
+
message.descriptor[:format] = WMQ::MQFMT_STRING
|
187
|
+
message.headers << dlh
|
188
|
+
assert_equal(true,@queue_manager.put(:q_name=>@in_queue.name, :message=>message))
|
189
|
+
|
190
|
+
message = WMQ::Message.new
|
191
|
+
assert_equal(true, @in_queue.get(:message=>message))
|
192
|
+
assert_equal(data, message.data)
|
193
|
+
assert_equal(1, message.headers.size)
|
194
|
+
reply_header = message.headers[0]
|
195
|
+
|
196
|
+
dlh.each_pair{|key, value| assert_equal(value, reply_header[key])}
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_cics
|
200
|
+
puts '****** test_cics ******'
|
201
|
+
cics = {:header_type =>:cics,
|
202
|
+
:reason =>WMQ::MQRC_UNKNOWN_REMOTE_Q_MGR,
|
203
|
+
:facility =>'TOKEN123',
|
204
|
+
:reply_to_format =>WMQ::MQFMT_STRING,
|
205
|
+
}
|
206
|
+
verify_header(cics, WMQ::MQFMT_NONE)
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_ims
|
210
|
+
puts '****** test_ims ******'
|
211
|
+
ims = {:header_type =>:ims,
|
212
|
+
:l_term_override =>'LTERM',
|
213
|
+
:reply_to_format =>WMQ::MQFMT_STRING,
|
214
|
+
}
|
215
|
+
verify_header(ims, WMQ::MQFMT_STRING)
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_transmission_header
|
219
|
+
puts '****** test_transmission_header ******'
|
220
|
+
xqh = {:header_type =>:xmit_q_header,
|
221
|
+
:remote_q_name =>'SOME_REMOTE_QUEUE',
|
222
|
+
:remote_q_mgr_name=>'SOME_REMOTE_Q_MGR',
|
223
|
+
:msg_type =>WMQ::MQMT_REQUEST,
|
224
|
+
:msg_id =>'my message Id',
|
225
|
+
}
|
226
|
+
verify_header(xqh, WMQ::MQFMT_STRING)
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_rf_header
|
230
|
+
puts '****** test_rf_header ******'
|
231
|
+
rfh = {:header_type =>:rf_header,
|
232
|
+
:name_value => {' name s' => ' v a "l" u e 1 ',
|
233
|
+
'n a m e 2 ' => 'v a l u e 2',
|
234
|
+
'' => ['"', '""', '"""', '""""', ''],
|
235
|
+
'name3'=>['"value3"', '', '"',' value 43"']},
|
236
|
+
}
|
237
|
+
verify_header(rfh, WMQ::MQFMT_STRING)
|
238
|
+
end
|
239
|
+
|
240
|
+
def test_rf_header_2
|
241
|
+
puts '****** test_rf_header_2 ******'
|
242
|
+
rfh2 = {:header_type =>:rf_header_2,
|
243
|
+
:xml => ['<hello>to the world</hello>',
|
244
|
+
'<another>xml like string</another>'],
|
245
|
+
}
|
246
|
+
verify_header(rfh2, WMQ::MQFMT_STRING)
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_multiple_headers
|
250
|
+
puts '****** test_multiple_headers ******'
|
251
|
+
headers = [{:header_type => :rf_header_2,
|
252
|
+
:xml => ['<hello>to the world</hello>',
|
253
|
+
'<another>xml like string</another>'],},
|
254
|
+
|
255
|
+
{:header_type => :rf_header,
|
256
|
+
:name_value => {' name s' => ' v a l u e 1 ',
|
257
|
+
'n a m e 2 ' => 'v a l u e 2',
|
258
|
+
'name3'=>['value3', '', 'value 43']} },
|
259
|
+
|
260
|
+
{:header_type => :ims,
|
261
|
+
:l_term_override => 'LTERM',
|
262
|
+
:reply_to_format => WMQ::MQFMT_STRING},
|
263
|
+
|
264
|
+
{:header_type => :rf_header,
|
265
|
+
:name_value => {' name s' => ' v a l u e 1 ',
|
266
|
+
'n a m e 2 ' => 'v a l u e 2',
|
267
|
+
'name3'=>['value3', '', 'value 43']} },
|
268
|
+
|
269
|
+
{:header_type => :cics,
|
270
|
+
:reason => WMQ::MQRC_UNKNOWN_REMOTE_Q_MGR,
|
271
|
+
:facility => 'TOKEN123',
|
272
|
+
:reply_to_format => WMQ::MQFMT_STRING},
|
273
|
+
|
274
|
+
{:header_type => :rf_header_2,
|
275
|
+
:xml => ['<hello>to the world</hello>', '<another>xml like string</another>'],},
|
276
|
+
|
277
|
+
{:header_type => :xmit_q_header,
|
278
|
+
:remote_q_name => 'SOME_REMOTE_QUEUE',
|
279
|
+
:remote_q_mgr_name=> 'SOME_REMOTE_Q_MGR',
|
280
|
+
:msg_type => WMQ::MQMT_REQUEST,
|
281
|
+
:msg_id => 'my message Id'},
|
282
|
+
]
|
283
|
+
verify_multiple_headers(headers, WMQ::MQFMT_STRING)
|
284
|
+
end
|
285
|
+
|
286
|
+
def test_xmit_multiple_headers
|
287
|
+
puts '****** test_xmit_q_header with ims header ******'
|
288
|
+
headers = [{:header_type => :xmit_q_header,
|
289
|
+
:remote_q_name => 'SOME_REMOTE_QUEUE',
|
290
|
+
:remote_q_mgr_name=> 'SOME_REMOTE_Q_MGR',
|
291
|
+
:msg_type => WMQ::MQMT_REQUEST,
|
292
|
+
:msg_id => 'my message Id'},
|
293
|
+
|
294
|
+
{:header_type => :ims,
|
295
|
+
:l_term_override => 'LTERM',
|
296
|
+
:reply_to_format => WMQ::MQFMT_STRING},
|
297
|
+
]
|
298
|
+
verify_multiple_headers(headers, WMQ::MQFMT_STRING)
|
299
|
+
end
|
300
|
+
|
301
|
+
def test_message_grouping
|
302
|
+
puts '****** test_message_grouping ******'
|
303
|
+
# Clear out queue of any messages
|
304
|
+
@in_queue.each { |message| }
|
305
|
+
|
306
|
+
msg = WMQ::Message.new
|
307
|
+
msg.data = 'First'
|
308
|
+
msg.descriptor[:msg_flags] = WMQ::MQMF_MSG_IN_GROUP
|
309
|
+
assert_equal(@out_queue.put(:message=>msg, :options => WMQ::MQPMO_LOGICAL_ORDER), true)
|
310
|
+
|
311
|
+
msg.data = 'Second'
|
312
|
+
assert_equal(@out_queue.put(:message=>msg, :options => WMQ::MQPMO_LOGICAL_ORDER), true)
|
313
|
+
|
314
|
+
msg.data = 'Last'
|
315
|
+
msg.descriptor[:msg_flags] = WMQ::MQMF_LAST_MSG_IN_GROUP
|
316
|
+
assert_equal(@out_queue.put(:message=>msg, :options => WMQ::MQPMO_LOGICAL_ORDER), true)
|
317
|
+
|
318
|
+
# Now retrieve the messages destructively
|
319
|
+
message = WMQ::Message.new
|
320
|
+
test_sizes.each do |size|
|
321
|
+
assert_equal(true, @in_queue.get(:message=>message, :match=>WMQ::MQMO_NONE))
|
322
|
+
assert_equal(size, message.data.length)
|
323
|
+
str = '0123456789ABCDEF' * (size/16) + '0123456789ABCDEF'[0,size%16]
|
324
|
+
assert_equal(str, message.data)
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ferocia-rubywmq
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Reid Morrison
|
9
|
+
- Edwin Fine
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-11-27 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: shoulda
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
description: RubyWMQ is a high performance native Ruby interface into WebSphere MQ.
|
32
|
+
email:
|
33
|
+
- reidmo@gmail.com
|
34
|
+
executables: []
|
35
|
+
extensions:
|
36
|
+
- ext/extconf.rb
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- examples/each_a.rb
|
40
|
+
- examples/each_b.rb
|
41
|
+
- examples/each_header.rb
|
42
|
+
- examples/files_to_q.cfg
|
43
|
+
- examples/files_to_q.rb
|
44
|
+
- examples/get_a.rb
|
45
|
+
- examples/get_client.rb
|
46
|
+
- examples/put1_a.rb
|
47
|
+
- examples/put1_b.rb
|
48
|
+
- examples/put1_c.rb
|
49
|
+
- examples/put_a.rb
|
50
|
+
- examples/put_b.rb
|
51
|
+
- examples/put_dlh.rb
|
52
|
+
- examples/put_dynamic_q.rb
|
53
|
+
- examples/put_group_a.rb
|
54
|
+
- examples/put_group_b.rb
|
55
|
+
- examples/put_rfh.rb
|
56
|
+
- examples/put_rfh2_a.rb
|
57
|
+
- examples/put_rfh2_b.rb
|
58
|
+
- examples/put_xmit_q.rb
|
59
|
+
- examples/q_to_files.cfg
|
60
|
+
- examples/q_to_files.rb
|
61
|
+
- examples/request.rb
|
62
|
+
- examples/server.rb
|
63
|
+
- ext/build.bat
|
64
|
+
- ext/build.sh
|
65
|
+
- ext/decode_rfh.c
|
66
|
+
- ext/decode_rfh.h
|
67
|
+
- ext/extconf.rb
|
68
|
+
- ext/extconf_client.rb
|
69
|
+
- ext/generate/generate_const.rb
|
70
|
+
- ext/generate/generate_reason.rb
|
71
|
+
- ext/generate/generate_structs.rb
|
72
|
+
- ext/generate/wmq_structs.erb
|
73
|
+
- ext/lib/wmq_temp.rb
|
74
|
+
- ext/wmq.c
|
75
|
+
- ext/wmq.h
|
76
|
+
- ext/wmq_message.c
|
77
|
+
- ext/wmq_mq_load.c
|
78
|
+
- ext/wmq_queue.c
|
79
|
+
- ext/wmq_queue_manager.c
|
80
|
+
- lib/wmq.rb
|
81
|
+
- LICENSE
|
82
|
+
- Manifest.txt
|
83
|
+
- README
|
84
|
+
- rubywmq.binary.gemspec
|
85
|
+
- rubywmq.gemspec
|
86
|
+
- tests/test.rb
|
87
|
+
- .document
|
88
|
+
homepage: https://github.com/reidmorrison/rubywmq
|
89
|
+
licenses:
|
90
|
+
- Apache License V2.0
|
91
|
+
post_install_message: ! '* ferocia-rubywmq builds against the WMQ libs, which aren''t
|
92
|
+
available for OS X.
|
93
|
+
|
94
|
+
* The gem will still install, but the build will be skipped, producing a
|
95
|
+
|
96
|
+
* non-functional gem, so you''ll need stubs. (You can skip the build elsewhere by
|
97
|
+
|
98
|
+
* setting the DISABLE_RUBYWMQ environment variable.)
|
99
|
+
|
100
|
+
'
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.8.4
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements:
|
117
|
+
- WebSphere MQ v5.3, v6 or v7 Client or Server with Development Kit
|
118
|
+
rubyforge_project: rubywmq
|
119
|
+
rubygems_version: 1.8.23
|
120
|
+
signing_key:
|
121
|
+
specification_version: 3
|
122
|
+
summary: Native Ruby interface into WebSphere MQ
|
123
|
+
test_files:
|
124
|
+
- tests/test.rb
|