ferocia-rubywmq 2.0.2 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +36 -0
- data/LICENSE.txt +1 -1
- data/README.md +36 -47
- data/Rakefile +12 -76
- 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 +36 -26
- 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 +78 -88
- data/lib/wmq.rb +17 -11
- 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 +23 -34
- data/tests/test.rb +0 -318
@@ -2,18 +2,18 @@ require 'erb'
|
|
2
2
|
|
3
3
|
class GenerateStructs
|
4
4
|
|
5
|
-
@@field_ignore_list = [
|
5
|
+
@@field_ignore_list = ['StrucId', 'Version', 'StrucLength']
|
6
6
|
|
7
7
|
# Store path to WebSphere MQ Structures
|
8
|
-
def initialize(wmq_includepath, templates_path='.')
|
9
|
-
@path
|
8
|
+
def initialize(wmq_includepath, templates_path = '.')
|
9
|
+
@path = wmq_includepath
|
10
10
|
@templates_path = templates_path
|
11
11
|
end
|
12
12
|
|
13
13
|
def extract_struct (filename, struct_name)
|
14
14
|
properties_list = []
|
15
|
-
line_number
|
16
|
-
found
|
15
|
+
line_number = 0
|
16
|
+
found = false
|
17
17
|
File.open(filename) do |file|
|
18
18
|
file.each do |line|
|
19
19
|
line_number += 1
|
@@ -26,7 +26,7 @@ class GenerateStructs
|
|
26
26
|
return(properties_list) if line =~ /^\s*\};/
|
27
27
|
match = /\s*(MQ\w+)\s+(\w+);/.match(line)
|
28
28
|
if match
|
29
|
-
type
|
29
|
+
type = match[1]
|
30
30
|
element = match[2]
|
31
31
|
properties_list.push([type, element])
|
32
32
|
end
|
@@ -39,22 +39,23 @@ class GenerateStructs
|
|
39
39
|
|
40
40
|
def rubyize_name(name)
|
41
41
|
name.gsub(/::/, '/').
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
|
43
|
+
gsub(/([a-z\d])([A-Z])/, '\1_\2').
|
44
|
+
tr("-", "_").
|
45
|
+
downcase
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.test_rubyize_name
|
49
49
|
test = self.new
|
50
|
-
[
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
[
|
51
|
+
['a', 'a'],
|
52
|
+
['A', 'a'],
|
53
|
+
['Aa', 'aa'],
|
54
|
+
['AA', 'aa'],
|
55
|
+
['AaA', 'aa_a'],
|
56
|
+
['MyFieldName', 'my_field_name'],
|
57
|
+
['MMyFieldNName', 'm_my_field_n_name'],
|
58
|
+
['ABCdefGHIjKlMnOPQrSTuvwxYz', 'ab_cdef_gh_ij_kl_mn_op_qr_s_tuvwx_yz']
|
58
59
|
].each do |item|
|
59
60
|
str = test.rubyize_name(item[0])
|
60
61
|
raise("rubyize_name('#{item[0]}') == #{str} != '#{item[1]})") if str != item[1]
|
@@ -68,7 +69,7 @@ class GenerateStructs
|
|
68
69
|
def generate(target_filename = 'wmq_structs.c')
|
69
70
|
erb = nil
|
70
71
|
File.open(@templates_path+'/wmq_structs.erb') { |file| erb = ERB.new(file.read) }
|
71
|
-
File.open(target_filename, 'w') {|file| file.write(generate_structs(erb)) }
|
72
|
+
File.open(target_filename, 'w') { |file| file.write(generate_structs(erb)) }
|
72
73
|
puts "Generated #{target_filename}"
|
73
74
|
end
|
74
75
|
end
|
@@ -1,71 +1,71 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
2
|
+
symbols = {
|
3
|
+
'descriptor=' => nil,
|
4
|
+
'headers=' => nil,
|
5
|
+
'data=' => nil,
|
6
|
+
'header_type' => nil,
|
7
|
+
'to_s' => nil,
|
8
|
+
'xml' => nil,
|
9
|
+
'name_value' => nil,
|
10
|
+
}
|
11
|
+
wmq_structs = [
|
12
|
+
# Message Descriptor
|
13
|
+
{ file: 'cmqc.h', struct: 'MQMD' },
|
14
|
+
|
15
|
+
# Message Descriptor 1
|
16
|
+
{ file: 'cmqc.h', struct: 'MQMD1', other_keys: [:remote_q_name, :remote_q_mgr_name] },
|
17
|
+
|
18
|
+
# Rules and formatting header2
|
19
|
+
{ file: 'cmqc.h', struct: 'MQRFH2', header: 'rf_header_2', struct_id: 'MQRFH_STRUC_ID',
|
20
|
+
other_keys: [:xml],
|
21
|
+
custom: true }, # Implement custom Message_build_rf_header_2 and Message_deblock_rf_header_2
|
22
|
+
|
23
|
+
# Rules and formatting header
|
24
|
+
{ file: 'cmqc.h', struct: 'MQRFH', header: 'rf_header', other_keys: [:name_value],
|
25
|
+
custom: true }, # Implement custom Message_build_rf_header and Message_deblock_rf_header
|
26
|
+
|
27
|
+
# Dead Letter Header
|
28
|
+
{ file: 'cmqc.h', struct: 'MQDLH', header: 'dead_letter_header',
|
29
|
+
defaults: 'MQDLH_DEF.CodedCharSetId = MQCCSI_INHERIT;' },
|
30
|
+
|
31
|
+
# CICS bridge header
|
32
|
+
{ file: 'cmqc.h', struct: 'MQCIH', header: 'cics' },
|
33
|
+
|
34
|
+
# Distribution header
|
35
|
+
{ file: 'cmqc.h', struct: 'MQDH', header: 'dist_header' },
|
36
|
+
|
37
|
+
# IMS information header
|
38
|
+
{ file: 'cmqc.h', struct: 'MQIIH', header: 'ims' },
|
39
|
+
|
40
|
+
# Reference message header (send large files over channels)
|
41
|
+
{ file: 'cmqc.h', struct: 'MQRMH', header: 'ref_msg_header' },
|
42
|
+
|
43
|
+
# Trigger Message
|
44
|
+
{ file: 'cmqc.h', struct: 'MQTM', header: 'trigger', format: false },
|
45
|
+
|
46
|
+
# Trigger Message 2 (character format)
|
47
|
+
{ file: 'cmqc.h', struct: 'MQTMC2' },
|
48
|
+
|
49
|
+
# Work Information header
|
50
|
+
{ file: 'cmqc.h', struct: 'MQWIH', header: 'work_info_header' },
|
51
|
+
|
52
|
+
# Transmission-queue header - Todo: Need to deal with MQMDE
|
53
|
+
{ file: 'cmqc.h', struct: 'MQXQH', header: 'xmit_q_header', format: 'MsgDesc.Format' },
|
54
|
+
]
|
55
|
+
|
56
|
+
wmq_structs.each do |struct|
|
57
|
+
# Parse WebSphere MQ 'C' Header file and extract elements
|
58
|
+
elements = extract_struct(@path+'/'+struct[:file], struct[:struct])
|
59
|
+
struct[:elements] = elements
|
60
|
+
|
61
|
+
# Add symbol for each struct name
|
62
|
+
symbols[struct[:header]]=nil if struct[:header]
|
63
|
+
|
64
|
+
# Add symbols for each element in C Struct
|
65
|
+
elements.each do |item|
|
66
|
+
symbols[rubyize_name(item[1])] = nil unless @@field_ignore_list.include?(item[1])
|
67
|
+
end
|
68
|
+
end
|
69
69
|
%>
|
70
70
|
/* --------------------------------------------------------------------------
|
71
71
|
*
|
data/ext/wmq.c
CHANGED
@@ -1,19 +1,3 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
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
|
#include "wmq.h"
|
18
2
|
|
19
3
|
VALUE wmq_queue;
|
data/ext/wmq.h
CHANGED
@@ -1,19 +1,3 @@
|
|
1
|
-
/* --------------------------------------------------------------------------
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
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
|
#include <ruby.h>
|
18
2
|
|
19
3
|
/* New with Ruby 1.9, define for prior Ruby versions */
|
data/ext/wmq_message.c
CHANGED
@@ -1,19 +1,3 @@
|
|
1
|
-
/* --------------------------------------------------------------------------
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
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
|
#include "wmq.h"
|
18
2
|
#include "decode_rfh.h"
|
19
3
|
|
@@ -200,9 +184,9 @@ void Message_build_mqmd(VALUE self, PMQMD pmqmd)
|
|
200
184
|
* message = WMQ::Message.new
|
201
185
|
*
|
202
186
|
* Example:
|
203
|
-
* message = WMQ::Message.new(:
|
204
|
-
* :
|
205
|
-
* :
|
187
|
+
* message = WMQ::Message.new(data: 'Hello World',
|
188
|
+
* descriptor: {
|
189
|
+
* format: WMQ::MQFMT_STRING
|
206
190
|
* })
|
207
191
|
*/
|
208
192
|
VALUE Message_initialize(int argc, VALUE *argv, VALUE self)
|
@@ -238,7 +222,7 @@ VALUE Message_initialize(int argc, VALUE *argv, VALUE self)
|
|
238
222
|
val = rb_hash_aref(parms, ID2SYM(ID_descriptor));
|
239
223
|
if (NIL_P(val))
|
240
224
|
{
|
241
|
-
rb_iv_set(self, "@
|
225
|
+
rb_iv_set(self, "@descriptor", rb_hash_new());
|
242
226
|
}
|
243
227
|
else
|
244
228
|
{
|
@@ -612,13 +596,13 @@ static VALUE Message_build_rf_header_2_each(VALUE element, struct Message_build_
|
|
612
596
|
* E.g.
|
613
597
|
*
|
614
598
|
* {
|
615
|
-
* :
|
616
|
-
* :
|
599
|
+
* header_type: :rf_header_2,
|
600
|
+
* xml: '<hello>to the world</hello>'
|
617
601
|
* }
|
618
602
|
* OR
|
619
603
|
* {
|
620
|
-
* :
|
621
|
-
* :
|
604
|
+
* header_type: :rf_header_2,
|
605
|
+
* xml: ['<hello>to the world</hello>', '<another>xml like string</another>'],
|
622
606
|
* }
|
623
607
|
*
|
624
608
|
*/
|
data/ext/wmq_mq_load.c
CHANGED
@@ -1,19 +1,3 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
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
|
#include "wmq.h"
|
18
2
|
|
19
3
|
#if defined _WIN32 && !defined __CYGWIN__
|
@@ -41,7 +25,11 @@
|
|
41
25
|
}
|
42
26
|
|
43
27
|
#define MQ_LIBRARY_SERVER "mqm"
|
44
|
-
#
|
28
|
+
#ifdef _WIN64
|
29
|
+
#define MQ_LIBRARY_CLIENT "mqic"
|
30
|
+
#else
|
31
|
+
#define MQ_LIBRARY_CLIENT "mqic32"
|
32
|
+
#endif
|
45
33
|
#elif defined(SOLARIS) || defined(__SVR4) || defined(__linux__) || defined(LINUX)
|
46
34
|
/*
|
47
35
|
* SOLARIS, LINUX
|
data/ext/wmq_queue.c
CHANGED
@@ -1,19 +1,3 @@
|
|
1
|
-
/* --------------------------------------------------------------------------
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
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
|
#include "wmq.h"
|
18
2
|
/* --------------------------------------------------
|
19
3
|
* Initialize Ruby ID's for Queue Class
|
@@ -179,7 +163,7 @@ static MQLONG Queue_extract_open_options(VALUE hash, VALUE name)
|
|
179
163
|
else if (!mq_open_options)
|
180
164
|
{
|
181
165
|
rb_raise(rb_eArgError,
|
182
|
-
"Either :mode or :
|
166
|
+
"Either :mode or :open_options is required. Both are missing from the parameters passed to initialize() for Queue: %s",
|
183
167
|
RSTRING_PTR(name));
|
184
168
|
}
|
185
169
|
|
@@ -228,16 +212,6 @@ void Queue_extract_put_message_options(VALUE hash, PMQPMO ppmo)
|
|
228
212
|
return;
|
229
213
|
}
|
230
214
|
|
231
|
-
/* Future Use:
|
232
|
-
* *:q_name => ['q_name1', 'q_name2'] # Not implemented: Future Use!!
|
233
|
-
* *:q_name => [ {queue_manager=>'QMGR_name',
|
234
|
-
* queue =>'queue name1'}, # Future Use!!
|
235
|
-
* { ... }
|
236
|
-
* ]
|
237
|
-
* *:resolved => { queue => 'Resolved queue name',
|
238
|
-
* queue_manager => 'Resolved queue manager name' }
|
239
|
-
*/
|
240
|
-
|
241
215
|
/*
|
242
216
|
* call-seq:
|
243
217
|
* new(...)
|
@@ -374,17 +348,21 @@ VALUE Queue_initialize(VALUE self, VALUE hash)
|
|
374
348
|
*
|
375
349
|
* Example:
|
376
350
|
* require 'wmq/wmq_client'
|
377
|
-
* queue_manager = WMQ::QueueManager.new(
|
378
|
-
*
|
351
|
+
* queue_manager = WMQ::QueueManager.new(
|
352
|
+
* q_mgr_name: 'REID',
|
353
|
+
* connection_name: 'localhost(1414)'
|
354
|
+
* )
|
379
355
|
* begin
|
380
356
|
* queue_manager.connect
|
381
357
|
*
|
382
358
|
* # Create Queue and clear any messages from the queue
|
383
|
-
* in_queue = WMQ::Queue.new(
|
384
|
-
*
|
385
|
-
*
|
386
|
-
*
|
387
|
-
*
|
359
|
+
* in_queue = WMQ::Queue.new(
|
360
|
+
* queue_manager: 'QMGR',
|
361
|
+
* mode: :input,
|
362
|
+
* dynamic_q_name: 'UNIT.TEST',
|
363
|
+
* q_name: 'SYSTEM.DEFAULT.MODEL.QUEUE',
|
364
|
+
* fail_if_exists: false
|
365
|
+
* )
|
388
366
|
* begin
|
389
367
|
* in_queue.open
|
390
368
|
* in_queue.each { |message| p message.data }
|
@@ -392,7 +370,7 @@ VALUE Queue_initialize(VALUE self, VALUE hash)
|
|
392
370
|
* # Note: Very important: Must close the queue explicitly
|
393
371
|
* in_queue.close
|
394
372
|
* end
|
395
|
-
* rescue => exc
|
373
|
+
* rescue Exception => exc
|
396
374
|
* queue_manager.backout
|
397
375
|
* raise exc
|
398
376
|
* ensure
|
@@ -576,34 +554,34 @@ VALUE Queue_close(VALUE self)
|
|
576
554
|
* Parameters:
|
577
555
|
* * a Hash consisting of one or more of the named parameters
|
578
556
|
* * Summary of parameters and their WebSphere MQ equivalents:
|
579
|
-
* queue.get(
|
580
|
-
* :
|
581
|
-
* :
|
582
|
-
* :
|
583
|
-
* :
|
584
|
-
* :
|
585
|
-
* :
|
586
|
-
* :
|
557
|
+
* queue.get( # WebSphere MQ Equivalents:
|
558
|
+
* message: my_message, # n/a : Instance of Message
|
559
|
+
* sync: false, # MQGMO_SYNCPOINT
|
560
|
+
* wait: 0, # MQGMO_WAIT, duration in ms
|
561
|
+
* match: WMQ::MQMO_NONE, # MQMO_*
|
562
|
+
* convert: false, # MQGMO_CONVERT
|
563
|
+
* fail_if_quiescing: true # MQOO_FAIL_IF_QUIESCING
|
564
|
+
* options: WMQ::MQGMO_FAIL_IF_QUIESCING # MQGMO_*
|
587
565
|
* )
|
588
566
|
*
|
589
567
|
* Mandatory Parameters
|
590
|
-
* * :message
|
568
|
+
* * :message [Message]
|
591
569
|
* * An instance of the WMQ::Message
|
592
570
|
*
|
593
571
|
* Optional Parameters
|
594
|
-
* * :sync
|
572
|
+
* * :sync [true|false]
|
595
573
|
* * Determines whether the get is performed under synchpoint.
|
596
574
|
* I.e. Under the current unit of work
|
597
575
|
* Default: false
|
598
576
|
*
|
599
|
-
* * :wait
|
577
|
+
* * :wait [Integer]
|
600
578
|
* * The time in milli-seconds to wait for a message if one is not immediately available
|
601
579
|
* on the queue
|
602
580
|
* * Note: Under the covers the put option MQGMO_WAIT is automatically set when :wait
|
603
581
|
* is supplied
|
604
582
|
* Default: Wait forever
|
605
583
|
*
|
606
|
-
* * :match
|
584
|
+
* * :match [Integer]
|
607
585
|
* * One or more of the following values:
|
608
586
|
* WMQ::MQMO_MATCH_MSG_ID
|
609
587
|
* WMQ::MQMO_MATCH_CORREL_ID
|
@@ -613,24 +591,24 @@ VALUE Queue_close(VALUE self)
|
|
613
591
|
* WMQ::MQMO_MATCH_MSG_TOKEN
|
614
592
|
* WMQ::MQMO_NONE
|
615
593
|
* * Multiple values can be or'd together. E.g.
|
616
|
-
* :
|
594
|
+
* match: WMQ::MQMO_MATCH_MSG_ID | WMQ::MQMO_MATCH_CORREL_ID
|
617
595
|
* * Please see the WebSphere MQ documentation for more details on the above options
|
618
596
|
* Default: WMQ::MQMO_MATCH_MSG_ID | WMQ::MQMO_MATCH_CORREL_ID
|
619
597
|
*
|
620
|
-
* * :convert
|
598
|
+
* * :convert [true|false]
|
621
599
|
* * When true, convert results in messages being converted to the local code page.
|
622
600
|
* E.g. When an EBCDIC text message from a mainframe is received, it will be converted
|
623
601
|
* to ASCII before passing the message data to the application.
|
624
602
|
* Default: false
|
625
603
|
*
|
626
|
-
* * :fail_if_quiescing
|
604
|
+
* * :fail_if_quiescing [true|false]
|
627
605
|
* * Determines whether the WMQ::Queue#get call will fail if the queue manager is
|
628
606
|
* in the process of being quiesced.
|
629
607
|
* * Note: This interface differs from other WebSphere MQ interfaces,
|
630
608
|
* they do not default to true.
|
631
609
|
* Default: true
|
632
610
|
*
|
633
|
-
* * :options
|
611
|
+
* * :options [Integer] (Advanced MQ Use only)
|
634
612
|
* * Numeric field containing any of the MQ Get message options or'd together
|
635
613
|
* * E.g. :options => WMQ::MQGMO_SYNCPOINT_IF_PERSISTENT | WMQ::MQGMO_MARK_SKIP_BACKOUT
|
636
614
|
* * Note: If :options is supplied, it is applied first, then the above parameters are
|
@@ -669,10 +647,10 @@ VALUE Queue_close(VALUE self)
|
|
669
647
|
* Example:
|
670
648
|
* require 'wmq/wmq'
|
671
649
|
*
|
672
|
-
* WMQ::QueueManager.connect(:
|
673
|
-
* qmgr.open_queue(:
|
650
|
+
* WMQ::QueueManager.connect(q_mgr_name: 'REID') do |qmgr|
|
651
|
+
* qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :input) do |queue|
|
674
652
|
* message = WMQ::Message.new
|
675
|
-
* if queue.get(:
|
653
|
+
* if queue.get(message: message)
|
676
654
|
* puts "Data Received: #{message.data}"
|
677
655
|
* else
|
678
656
|
* puts 'No message available'
|
@@ -825,16 +803,16 @@ VALUE Queue_get(VALUE self, VALUE hash)
|
|
825
803
|
* Parameters:
|
826
804
|
* * A Hash consisting of one or more of the named parameters
|
827
805
|
* * Summary of parameters and their WebSphere MQ equivalents
|
828
|
-
* queue.put(
|
829
|
-
*
|
830
|
-
*
|
831
|
-
*
|
832
|
-
*
|
833
|
-
*
|
834
|
-
*
|
835
|
-
*
|
836
|
-
*
|
837
|
-
*
|
806
|
+
* queue.put( # WebSphere MQ Equivalents:
|
807
|
+
* message: my_message, # n/a : Instance of Message
|
808
|
+
* data: 'Hello World', # n/a : Data to send
|
809
|
+
* sync: false, # MQGMO_SYNCPOINT
|
810
|
+
* new_id: true, # MQPMO_NEW_MSG_ID & MQPMO_NEW_CORREL_ID
|
811
|
+
* new_msg_id: true, # MQPMO_NEW_MSG_ID
|
812
|
+
* new_correl_id: true, # MQPMO_NEW_CORREL_ID
|
813
|
+
* fail_if_quiescing: true, # MQOO_FAIL_IF_QUIESCING
|
814
|
+
* options: WMQ::MQPMO_FAIL_IF_QUIESCING # MQPMO_*
|
815
|
+
* )
|
838
816
|
*
|
839
817
|
* Mandatory Parameters:
|
840
818
|
*
|
@@ -925,22 +903,22 @@ VALUE Queue_get(VALUE self, VALUE hash)
|
|
925
903
|
* Example:
|
926
904
|
* require 'wmq/wmq_client'
|
927
905
|
*
|
928
|
-
* WMQ::QueueManager.connect(:
|
929
|
-
* qmgr.open_queue(:
|
906
|
+
* WMQ::QueueManager.connect(q_mgr_name: 'REID', connection_name: 'localhost(1414)') do |qmgr|
|
907
|
+
* qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :output) do |queue|
|
930
908
|
*
|
931
909
|
* # First message
|
932
|
-
* queue.put(:
|
910
|
+
* queue.put(data: 'Hello World')
|
933
911
|
*
|
934
912
|
* # Set Format of message to string
|
935
913
|
* message = WMQ::Message.new
|
936
914
|
* message.descriptor[:format] = WMQ::MQFMT_STRING
|
937
|
-
* queue.put(:message
|
915
|
+
* queue.put(message: message, data: 'Hello Again')
|
938
916
|
*
|
939
917
|
* # Or, pass the data in the message
|
940
918
|
* message = WMQ::Message.new
|
941
919
|
* message.descriptor[:format] = WMQ::MQFMT_STRING
|
942
920
|
* message.data = 'Hello Again'
|
943
|
-
* queue.put(:message
|
921
|
+
* queue.put(message: message)
|
944
922
|
* end
|
945
923
|
* end
|
946
924
|
*/
|
@@ -1048,20 +1026,20 @@ static VALUE Queue_singleton_open_ensure(VALUE queue)
|
|
1048
1026
|
* Parameters:
|
1049
1027
|
* * Since the number of parameters can vary dramatically, all parameters are passed by name in a hash
|
1050
1028
|
* * Summary of parameters and their WebSphere MQ equivalents:
|
1051
|
-
* queue = Queue.new(
|
1052
|
-
*
|
1053
|
-
*
|
1054
|
-
*
|
1055
|
-
*
|
1056
|
-
*
|
1057
|
-
*
|
1058
|
-
*
|
1059
|
-
*
|
1060
|
-
*
|
1061
|
-
*
|
1062
|
-
*
|
1063
|
-
*
|
1064
|
-
*
|
1029
|
+
* queue = Queue.new( # WebSphere MQ Equivalents:
|
1030
|
+
* queue_manager: queue_manager, # n/a : Instance of QueueManager
|
1031
|
+
* q_name: 'Queue Name', # MQOD.ObjectName
|
1032
|
+
* q_name: { queue_manager:'QMGR_name', # MQOD.ObjectQMgrName
|
1033
|
+
* q_name: 'q_name'}
|
1034
|
+
* mode: :input or :input_shared or :input_exclusive or :output,
|
1035
|
+
* fail_if_quiescing: true # MQOO_FAIL_IF_QUIESCING
|
1036
|
+
* fail_if_exists: true, # For dynamic queues, fail if it already exists
|
1037
|
+
* open_options: WMQ::MQOO_BIND_ON_OPEN | ... # MQOO_*
|
1038
|
+
* close_options: WMQ::MQCO_DELETE_PURGE # MQCO_*
|
1039
|
+
* dynamic_q_name: 'Name of Dynamic Queue' # MQOD.DynamicQName
|
1040
|
+
* alternate_user_id: 'userid', # MQOD.AlternateUserId
|
1041
|
+
* alternate_security_id: '' # MQOD.AlternateSecurityId
|
1042
|
+
* )
|
1065
1043
|
*
|
1066
1044
|
* Mandatory Parameters
|
1067
1045
|
* * :queue_manager
|
@@ -1120,6 +1098,9 @@ static VALUE Queue_singleton_open_ensure(VALUE queue)
|
|
1120
1098
|
* * Note: For now it is also necessary to specify these options when calling
|
1121
1099
|
* WMQ::Queue#each. A change will be made to each to address this.
|
1122
1100
|
* Equivalent to: MQOO_BROWSE
|
1101
|
+
* * Default: None.
|
1102
|
+
* If no :mode is supplied, then :open_options must be supplied.
|
1103
|
+
* In this way any custom combination of open options can be supplied.
|
1123
1104
|
*
|
1124
1105
|
* Optional Parameters
|
1125
1106
|
* * :fail_if_quiescing => true or false
|
@@ -1198,11 +1179,13 @@ static VALUE Queue_singleton_open_ensure(VALUE queue)
|
|
1198
1179
|
* # Put 10 Hello World messages onto a queue
|
1199
1180
|
* require 'wmq/wmq_client'
|
1200
1181
|
*
|
1201
|
-
* WMQ::QueueManager.connect(:
|
1202
|
-
* WMQ::Queue.open(
|
1203
|
-
*
|
1204
|
-
*
|
1205
|
-
*
|
1182
|
+
* WMQ::QueueManager.connect(q_mgr_name: 'REID', connection_name: 'localhost(1414)') do |qmgr|
|
1183
|
+
* WMQ::Queue.open(
|
1184
|
+
* queue_manager: qmgr,
|
1185
|
+
* q_name: 'TEST.QUEUE',
|
1186
|
+
* mode: :output
|
1187
|
+
* ) do |queue|
|
1188
|
+
* 10.times { |counter| queue.put(data: "Hello World #{counter}") }
|
1206
1189
|
* end
|
1207
1190
|
* end
|
1208
1191
|
*/
|
@@ -1247,8 +1230,8 @@ VALUE Queue_singleton_open(int argc, VALUE *argv, VALUE self)
|
|
1247
1230
|
* Example:
|
1248
1231
|
* require 'wmq/wmq'
|
1249
1232
|
*
|
1250
|
-
* WMQ::QueueManager.connect(:
|
1251
|
-
* qmgr.open_queue(:
|
1233
|
+
* WMQ::QueueManager.connect(q_mgr_name:'REID') do |qmgr|
|
1234
|
+
* qmgr.open_queue(q_name: 'TEST.QUEUE', mode: :input) do |queue|
|
1252
1235
|
* queue.each do |message|
|
1253
1236
|
* puts "Data Received: #{message.data}"
|
1254
1237
|
* end
|