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.
- data/.document +0 -4
- data/LICENSE.txt +201 -0
- data/README.md +408 -0
- data/Rakefile +91 -0
- data/examples/each_a.rb +1 -17
- data/examples/each_b.rb +1 -17
- data/examples/each_header.rb +3 -19
- data/examples/files_to_q.rb +1 -17
- data/examples/get_a.rb +1 -17
- data/examples/get_client.rb +5 -21
- data/examples/put1_a.rb +1 -17
- data/examples/put1_b.rb +1 -17
- data/examples/put1_c.rb +3 -19
- data/examples/put_a.rb +1 -17
- data/examples/put_b.rb +1 -17
- data/examples/put_dlh.rb +4 -20
- data/examples/put_dynamic_q.rb +1 -17
- data/examples/put_group_a.rb +1 -17
- data/examples/put_group_b.rb +1 -17
- data/examples/put_rfh.rb +12 -28
- data/examples/put_rfh2_a.rb +5 -21
- data/examples/put_rfh2_b.rb +5 -21
- data/examples/put_xmit_q.rb +2 -18
- data/examples/q_to_files.rb +1 -17
- data/examples/request.rb +7 -23
- data/examples/server.rb +10 -26
- data/ext/extconf.rb +26 -46
- data/ext/extconf_client.rb +3 -19
- data/ext/generate/generate_const.rb +16 -43
- data/ext/generate/generate_reason.rb +23 -36
- data/ext/generate/generate_structs.rb +7 -22
- data/ext/generate/wmq_structs.erb +28 -58
- data/ext/wmq.c +1 -4
- data/ext/wmq.h +5 -1
- data/ext/wmq_message.c +1 -1
- data/ext/wmq_mq_load.c +1 -1
- data/ext/wmq_queue.c +1 -1
- data/ext/wmq_queue_manager.c +3 -3
- data/lib/rubywmq.rb +1 -0
- data/lib/wmq.rb +13 -26
- data/lib/wmq/message.rb +70 -0
- data/{ext/lib/wmq_temp.rb → lib/wmq/queue_manager.rb} +11 -98
- data/lib/wmq/version.rb +3 -0
- data/tests/test.rb +30 -40
- metadata +10 -20
- data/LICENSE +0 -13
- data/Manifest.txt +0 -20
- data/README +0 -73
- data/ext/build.bat +0 -3
- data/ext/build.sh +0 -6
- data/rubywmq.binary.gemspec +0 -32
- data/rubywmq.gemspec +0 -33
@@ -1,20 +1,4 @@
|
|
1
|
-
<%
|
2
|
-
################################################################################
|
3
|
-
# Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
################################################################################
|
17
|
-
|
1
|
+
<%
|
18
2
|
symbols = {
|
19
3
|
'descriptor='=>nil,
|
20
4
|
'headers='=>nil,
|
@@ -68,7 +52,7 @@
|
|
68
52
|
# Transmission-queue header - Todo: Need to deal with MQMDE
|
69
53
|
{:file=>'cmqc.h', :struct=>'MQXQH', :header=>'xmit_q_header', :format=>'MsgDesc.Format'},
|
70
54
|
]
|
71
|
-
|
55
|
+
|
72
56
|
wmq_structs.each do |struct|
|
73
57
|
# Parse WebSphere MQ 'C' Header file and extract elements
|
74
58
|
elements = extract_struct(@path+'/'+struct[:file], struct[:struct])
|
@@ -84,20 +68,6 @@
|
|
84
68
|
end
|
85
69
|
%>
|
86
70
|
/* --------------------------------------------------------------------------
|
87
|
-
* Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
88
|
-
*
|
89
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
90
|
-
* you may not use this file except in compliance with the License.
|
91
|
-
* You may obtain a copy of the License at
|
92
|
-
*
|
93
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
94
|
-
*
|
95
|
-
* Unless required by applicable law or agreed to in writing, software
|
96
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
97
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
98
|
-
* See the License for the specific language governing permissions and
|
99
|
-
* limitations under the License.
|
100
|
-
* --------------------------------------------------------------------------
|
101
71
|
*
|
102
72
|
* WARNING: DO NOT MODIFY THIS FILE
|
103
73
|
*
|
@@ -110,16 +80,16 @@
|
|
110
80
|
/* --------------------------------------------------------------------------
|
111
81
|
* Static's to hold Symbols
|
112
82
|
* --------------------------------------------------------------------------*/
|
113
|
-
<%
|
83
|
+
<%
|
114
84
|
header_file = 'cmqc.h'
|
115
85
|
struct = 'MQMD'
|
116
86
|
|
117
87
|
# Define static variables to hold Ruby symbols
|
118
88
|
key_list = symbols.keys.sort
|
119
|
-
key_list.each do |key, value|
|
89
|
+
key_list.each do |key, value|
|
120
90
|
%><%="static ID ID_#{key.sub('=', '_set')};\n" %><%
|
121
91
|
end
|
122
|
-
|
92
|
+
|
123
93
|
# initialize symbols
|
124
94
|
%>
|
125
95
|
/* --------------------------------------------------------------------------
|
@@ -127,7 +97,7 @@
|
|
127
97
|
* --------------------------------------------------------------------------*/
|
128
98
|
void wmq_structs_id_init()
|
129
99
|
{
|
130
|
-
<% key_list.each do |key, value|
|
100
|
+
<% key_list.each do |key, value|
|
131
101
|
%><%=" ID_%-20s = rb_intern(\"%s\");\n"% [key.sub('=', '_set'), key] %><%
|
132
102
|
end
|
133
103
|
%>}
|
@@ -145,18 +115,18 @@ void Message_from_<%=struct_name.downcase%>(VALUE hash, <%=struct_name%>* <%=var
|
|
145
115
|
{
|
146
116
|
VALUE str;
|
147
117
|
size_t size;
|
148
|
-
size_t length;
|
118
|
+
size_t length;
|
149
119
|
size_t i;
|
150
120
|
char* pChar;
|
151
|
-
|
121
|
+
|
152
122
|
<%
|
153
123
|
elements.each do |item|
|
154
124
|
type = item[0]
|
155
125
|
name = item[1]
|
156
|
-
|
126
|
+
|
157
127
|
next if @@field_ignore_list.include?(name) ||
|
158
128
|
(name=='Format' && struct[:header])
|
159
|
-
|
129
|
+
|
160
130
|
match = /(MQ\D+)/.match(type)
|
161
131
|
type = "#{match[1]}S" if match[1] != type
|
162
132
|
%><%= if type == 'MQMDS'
|
@@ -164,25 +134,25 @@ void Message_from_<%=struct_name.downcase%>(VALUE hash, <%=struct_name%>* <%=var
|
|
164
134
|
else
|
165
135
|
" %-16s(hash, %-30s #{variable}->%s)\n" % ["WMQ_#{type}2HASH", rubyize_name(name)+',',name]
|
166
136
|
end %><%
|
167
|
-
end
|
137
|
+
end
|
168
138
|
%>}
|
169
139
|
|
170
140
|
static int Message_to_<%=struct_name.downcase%>_each (VALUE key, VALUE value, <%=struct_name%>* p<%=struct_name.downcase%>)
|
171
141
|
{
|
172
142
|
VALUE str;
|
173
143
|
size_t size;
|
174
|
-
size_t length;
|
144
|
+
size_t length;
|
175
145
|
VALUE val;
|
176
146
|
ID id = rb_to_id(key);
|
177
|
-
|
147
|
+
|
178
148
|
<% contains = nil
|
179
149
|
elements.each do |item|
|
180
150
|
type = item[0]
|
181
151
|
name = item[1]
|
182
|
-
|
152
|
+
|
183
153
|
next if @@field_ignore_list.include?(name) ||
|
184
154
|
(name=='Format' && struct[:header])
|
185
|
-
|
155
|
+
|
186
156
|
match = /(MQ\D+)/.match(type)
|
187
157
|
type = "#{match[1]}S" if match[1] != type
|
188
158
|
%><%= if type == 'MQMDS'
|
@@ -198,9 +168,9 @@ static int Message_to_<%=struct_name.downcase%>_each (VALUE key, VALUE value, <%
|
|
198
168
|
else<% end
|
199
169
|
end
|
200
170
|
%><%=struct[:header]?" if(id != ID_header_type)":""%><%
|
201
|
-
if contains
|
171
|
+
if contains
|
202
172
|
%> {
|
203
|
-
Message_to_<%= contains%>_each(key, value, &pmqxqh->MsgDesc);
|
173
|
+
Message_to_<%= contains%>_each(key, value, &pmqxqh->MsgDesc);
|
204
174
|
}<%
|
205
175
|
else%>
|
206
176
|
{
|
@@ -215,7 +185,7 @@ void Message_to_<%=struct_name.downcase%>(VALUE hash, <%=struct_name%>* p<%=stru
|
|
215
185
|
{
|
216
186
|
rb_hash_foreach(hash, Message_to_<%=struct_name.downcase%>_each, (VALUE)p<%=struct_name.downcase%>);
|
217
187
|
}
|
218
|
-
<% end # wmq_structs.each
|
188
|
+
<% end # wmq_structs.each
|
219
189
|
%>
|
220
190
|
|
221
191
|
/* --------------------------------------------------------------------------
|
@@ -240,10 +210,10 @@ void Message_deblock(VALUE self, PMQMD pmqmd, PMQBYTE p_buffer, MQLONG total_len
|
|
240
210
|
{
|
241
211
|
VALUE hash = rb_hash_new();
|
242
212
|
P<%=struct[:struct]%> p_header = (P<%=struct[:struct]%>)p_data;
|
243
|
-
|
213
|
+
|
244
214
|
if(trace_level>2)
|
245
215
|
printf("WMQ::Message#deblock Found <%=struct[:header]%>\n");
|
246
|
-
|
216
|
+
|
247
217
|
if(memcmp(p_header->StrucId, <%=struct[:struct_id] || "#{struct[:struct].upcase}_STRUC_ID"%>, sizeof(p_header->StrucId)) != 0)
|
248
218
|
{
|
249
219
|
if(trace_level>1)
|
@@ -277,7 +247,7 @@ void Message_deblock(VALUE self, PMQMD pmqmd, PMQBYTE p_buffer, MQLONG total_len
|
|
277
247
|
else
|
278
248
|
<%
|
279
249
|
end
|
280
|
-
end # wmq_structs.each
|
250
|
+
end # wmq_structs.each
|
281
251
|
%> {
|
282
252
|
break;
|
283
253
|
}
|
@@ -287,7 +257,7 @@ void Message_deblock(VALUE self, PMQMD pmqmd, PMQBYTE p_buffer, MQLONG total_len
|
|
287
257
|
{
|
288
258
|
strncpy(pmqmd->Format, p_format, MQ_FORMAT_LENGTH);
|
289
259
|
}
|
290
|
-
|
260
|
+
|
291
261
|
Message_from_mqmd(descriptor, pmqmd);
|
292
262
|
rb_funcall(self, ID_descriptor_set, 1, descriptor);
|
293
263
|
rb_funcall(self, ID_headers_set, 1, headers);
|
@@ -302,8 +272,8 @@ void Message_build_set_format(ID header_type, PMQBYTE p_format)
|
|
302
272
|
%> if(header_type == ID_<%=struct[:header]%>) { memcpy(p_format, MQFMT_<%=struct[:header].upcase%>, MQ_FORMAT_LENGTH); return;}
|
303
273
|
<%
|
304
274
|
end
|
305
|
-
end # wmq_structs.each
|
306
|
-
|
275
|
+
end # wmq_structs.each
|
276
|
+
|
307
277
|
%>
|
308
278
|
rb_raise(rb_eArgError, "Invalid/Unknown header_type supplied in WMQ::Message#headers array");
|
309
279
|
}
|
@@ -332,7 +302,7 @@ int Message_build_header (VALUE hash, struct Message_build_header_arg* parg)
|
|
332
302
|
|
333
303
|
if(parg->trace_level>2)
|
334
304
|
printf ("WMQ::Message#build_header Found <%=struct[:header]%>\n");
|
335
|
-
|
305
|
+
|
336
306
|
p_data = Message_autogrow_data_buffer(parg, sizeof(<%=struct[:struct]%>));
|
337
307
|
|
338
308
|
memcpy(p_data, &<%=struct[:struct]%>_DEF, sizeof(<%=struct[:struct]%>));
|
@@ -351,13 +321,13 @@ int Message_build_header (VALUE hash, struct Message_build_header_arg* parg)
|
|
351
321
|
|
352
322
|
if(parg->trace_level>2)
|
353
323
|
printf ("WMQ::Message#build_header data offset:%ld\n", (long)(*(parg->p_data_offset)));
|
354
|
-
<% end
|
324
|
+
<% end
|
355
325
|
%> }
|
356
326
|
else
|
357
327
|
<%
|
358
328
|
end
|
359
|
-
end # wmq_structs.each
|
360
|
-
|
329
|
+
end # wmq_structs.each
|
330
|
+
|
361
331
|
%> {
|
362
332
|
rb_raise(rb_eArgError, "Unknown :header_type supplied in WMQ::Message#headers array");
|
363
333
|
}
|
data/ext/wmq.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
2
|
+
* Copyright 2006 J. Reid Morrison
|
3
3
|
*
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
* you may not use this file except in compliance with the License.
|
@@ -80,9 +80,6 @@ void Init_wmq() {
|
|
80
80
|
QueueManager_selector_id_init();
|
81
81
|
QueueManager_command_id_init();
|
82
82
|
wmq_structs_id_init();
|
83
|
-
|
84
|
-
rb_require("wmq/wmq_temp");
|
85
|
-
rb_require("wmq/wmq_const");
|
86
83
|
}
|
87
84
|
|
88
85
|
/*
|
data/ext/wmq.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* --------------------------------------------------------------------------
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
2
|
+
* Copyright 2006 J. Reid Morrison
|
3
3
|
*
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
* you may not use this file except in compliance with the License.
|
@@ -33,6 +33,10 @@
|
|
33
33
|
#define rb_str_set_len(str, length) (RSTRING_LEN(str) = (length))
|
34
34
|
#endif
|
35
35
|
|
36
|
+
#ifndef _int64
|
37
|
+
#define _int64 long long
|
38
|
+
#endif
|
39
|
+
|
36
40
|
#include <cmqc.h>
|
37
41
|
#include <cmqxc.h>
|
38
42
|
|
data/ext/wmq_message.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* --------------------------------------------------------------------------
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
2
|
+
* Copyright 2006 J. Reid Morrison
|
3
3
|
*
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
* you may not use this file except in compliance with the License.
|
data/ext/wmq_mq_load.c
CHANGED
data/ext/wmq_queue.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* --------------------------------------------------------------------------
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
2
|
+
* Copyright 2006 J. Reid Morrison
|
3
3
|
*
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
* you may not use this file except in compliance with the License.
|
data/ext/wmq_queue_manager.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright 2006 J. Reid Morrison
|
2
|
+
* Copyright 2006 J. Reid Morrison
|
3
3
|
*
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
* you may not use this file except in compliance with the License.
|
@@ -429,8 +429,8 @@ VALUE QueueManager_connect(VALUE self)
|
|
429
429
|
}
|
430
430
|
|
431
431
|
pqm->MQCONNX(
|
432
|
-
RSTRING_PTR(name),
|
433
|
-
&pqm->connect_options, /*
|
432
|
+
RSTRING_PTR(name), /* queue manager */
|
433
|
+
&pqm->connect_options, /* connection options */
|
434
434
|
&pqm->hcon, /* connection handle */
|
435
435
|
&pqm->comp_code, /* completion code */
|
436
436
|
&pqm->reason_code); /* connect reason code */
|
data/lib/rubywmq.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'wmq'
|
data/lib/wmq.rb
CHANGED
@@ -1,29 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
################################################################################
|
1
|
+
require 'wmq/version'
|
2
|
+
require 'wmq/constants'
|
3
|
+
require 'wmq/constants_admin'
|
4
|
+
require 'wmq/queue_manager'
|
5
|
+
require 'wmq/message'
|
16
6
|
|
17
|
-
# Load wmq
|
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
|
7
|
+
# Load wmq using the auto-load library.
|
21
8
|
#
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
9
|
+
# If it fails, then it is most likely since this platform is not supported
|
10
|
+
# by the auto load facility in Ruby WMQ, so try to load client linked library
|
11
|
+
# For Example AIX does not support Autoload whereas Windows and Linux are supported
|
12
|
+
begin
|
13
|
+
require 'wmq/wmq'
|
14
|
+
rescue LoadError
|
15
|
+
require 'wmq/wmq_client'
|
29
16
|
end
|
data/lib/wmq/message.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Message Ruby methods
|
2
|
+
module WMQ
|
3
|
+
# Message contains the message descriptor (MQMD), data
|
4
|
+
# and any headers.
|
5
|
+
#
|
6
|
+
# Note:
|
7
|
+
# * The format in the descriptor applies only to the format of the data portion,
|
8
|
+
# not the format of any included headers
|
9
|
+
# * The message format can ONLY be supplied in the descriptor.
|
10
|
+
# * I.e. It is the format of the data, Not the headers.
|
11
|
+
# * On the wire formats are determined automatically by the :header_type key for
|
12
|
+
# each header
|
13
|
+
# * Other WebSphere MQ interfaces require that the formats be "daisy-chained"
|
14
|
+
# * I.e. The MQMD.Format is actually the format of the first header
|
15
|
+
# * Ruby WMQ removes this tedious requirement and performs this
|
16
|
+
# requirement automatically under the covers
|
17
|
+
# * The format of any header should not be supplied in the descriptor or any header
|
18
|
+
#
|
19
|
+
# Message has the following attributes:
|
20
|
+
# * descriptor = {
|
21
|
+
# # WebSphere MQ Equivalent
|
22
|
+
# :format => WMQ::MQFMT_STRING, # MQMD.Format - Format of data only
|
23
|
+
# WMQ::MQFMT_NONE # Do not supply header formats here
|
24
|
+
# :original_length => Number # MQMD.OriginalLength
|
25
|
+
# :priority => 0 .. 9 # MQMD.Priority
|
26
|
+
# :put_time => String # MQMD.PutTime
|
27
|
+
# :msg_id => String ...
|
28
|
+
# :expiry => Number
|
29
|
+
# :persistence => Number
|
30
|
+
# :reply_to_q => String
|
31
|
+
# :correl_id => String
|
32
|
+
# :feedback => Number
|
33
|
+
# :offset => Number
|
34
|
+
# :report => Number
|
35
|
+
# :msg_flags => Number
|
36
|
+
# :reply_to_q_mgr => String
|
37
|
+
# :appl_identity_data => String
|
38
|
+
# :put_appl_name => String
|
39
|
+
# :user_identifier => String
|
40
|
+
# :msg_seq_number => Number
|
41
|
+
# :appl_origin_data => String
|
42
|
+
# :accounting_token => String
|
43
|
+
# :backout_count => Number
|
44
|
+
# :coded_char_set_id => Number
|
45
|
+
# :put_appl_type => Number
|
46
|
+
# :msg_type => Number
|
47
|
+
# :group_id => String
|
48
|
+
# :put_date => String
|
49
|
+
# :encoding => Number
|
50
|
+
# }
|
51
|
+
# * data => String
|
52
|
+
# * headers => Array of Hashes
|
53
|
+
# * Note: Do not supply the format of any header. Ruby WMQ does this for you.
|
54
|
+
#
|
55
|
+
# The following headers are supported:
|
56
|
+
# * Rules And Formatting Header (RFH)
|
57
|
+
# :header_type => :rf_header
|
58
|
+
# :....
|
59
|
+
# * Rules and Formatting V2 Header (RFH2)
|
60
|
+
# ....
|
61
|
+
# * Dead Letter Header
|
62
|
+
# * CICS Header
|
63
|
+
# * IMS Header
|
64
|
+
# * Transmission Queue Header
|
65
|
+
# * ...
|
66
|
+
class Message
|
67
|
+
attr_accessor :data, :descriptor, :headers
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -1,35 +1,6 @@
|
|
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
|
-
|
1
|
+
# QueueManager ruby methods
|
17
2
|
module WMQ
|
18
|
-
|
19
|
-
# Temporary placeholder until the following code is moved to 'C'
|
20
|
-
|
21
|
-
#
|
22
3
|
class QueueManager
|
23
|
-
def method_missing(name, *args)
|
24
|
-
if args.size == 1
|
25
|
-
self.execute({:command=>name}.merge(args[0]))
|
26
|
-
elsif args.size == 0
|
27
|
-
self.execute({:command=>name})
|
28
|
-
else
|
29
|
-
raise("Invalid arguments supplied to QueueManager#:#{name}, args:#{args}")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
4
|
# Execute any MQSC command against the queue manager
|
34
5
|
#
|
35
6
|
# Example
|
@@ -124,74 +95,16 @@ module WMQ
|
|
124
95
|
return self.put(parms)
|
125
96
|
end
|
126
97
|
|
127
|
-
|
98
|
+
# Expose Commands directly as Queue Manager methods
|
99
|
+
def method_missing(name, *args)
|
100
|
+
if args.size == 1
|
101
|
+
self.execute({:command=>name}.merge(args[0]))
|
102
|
+
elsif args.size == 0
|
103
|
+
self.execute({:command=>name})
|
104
|
+
else
|
105
|
+
raise("Invalid arguments supplied to QueueManager#:#{name}, args:#{args}")
|
106
|
+
end
|
107
|
+
end
|
128
108
|
|
129
|
-
# Message contains the message descriptor (MQMD), data
|
130
|
-
# and any headers.
|
131
|
-
#
|
132
|
-
# Note:
|
133
|
-
# * The format in the descriptor applies only to the format of the data portion,
|
134
|
-
# not the format of any included headers
|
135
|
-
# * The message format can ONLY be supplied in the descriptor.
|
136
|
-
# * I.e. It is the format of the data, Not the headers.
|
137
|
-
# * On the wire formats are determined automatically by the :header_type key for
|
138
|
-
# each header
|
139
|
-
# * Other WebSphere MQ interfaces require that the formats be "daisy-chained"
|
140
|
-
# * I.e. The MQMD.Format is actually the format of the first header
|
141
|
-
# * Ruby WMQ removes this tedious requirement and performs this
|
142
|
-
# requirement automatically under the covers
|
143
|
-
# * The format of any header should not be supplied in the descriptor or any header
|
144
|
-
#
|
145
|
-
# Message has the following attributes:
|
146
|
-
# * descriptor = {
|
147
|
-
# # WebSphere MQ Equivalent
|
148
|
-
# :format => WMQ::MQFMT_STRING, # MQMD.Format - Format of data only
|
149
|
-
# WMQ::MQFMT_NONE # Do not supply header formats here
|
150
|
-
# :original_length => Number # MQMD.OriginalLength
|
151
|
-
# :priority => 0 .. 9 # MQMD.Priority
|
152
|
-
# :put_time => String # MQMD.PutTime
|
153
|
-
# :msg_id => String ...
|
154
|
-
# :expiry => Number
|
155
|
-
# :persistence => Number
|
156
|
-
# :reply_to_q => String
|
157
|
-
# :correl_id => String
|
158
|
-
# :feedback => Number
|
159
|
-
# :offset => Number
|
160
|
-
# :report => Number
|
161
|
-
# :msg_flags => Number
|
162
|
-
# :reply_to_q_mgr => String
|
163
|
-
# :appl_identity_data => String
|
164
|
-
# :put_appl_name => String
|
165
|
-
# :user_identifier => String
|
166
|
-
# :msg_seq_number => Number
|
167
|
-
# :appl_origin_data => String
|
168
|
-
# :accounting_token => String
|
169
|
-
# :backout_count => Number
|
170
|
-
# :coded_char_set_id => Number
|
171
|
-
# :put_appl_type => Number
|
172
|
-
# :msg_type => Number
|
173
|
-
# :group_id => String
|
174
|
-
# :put_date => String
|
175
|
-
# :encoding => Number
|
176
|
-
# }
|
177
|
-
# * data => String
|
178
|
-
# * headers => Array of Hashes
|
179
|
-
# * Note: Do not supply the format of any header. Ruby WMQ does this for you.
|
180
|
-
#
|
181
|
-
# The following headers are supported:
|
182
|
-
# * Rules And Formatting Header (RFH)
|
183
|
-
# :header_type => :rf_header
|
184
|
-
# :....
|
185
|
-
# * Rules and Formatting V2 Header (RFH2)
|
186
|
-
# ....
|
187
|
-
# * Dead Letter Header
|
188
|
-
# * CICS Header
|
189
|
-
# * IMS Header
|
190
|
-
# * Transmission Queue Header
|
191
|
-
# * ...
|
192
|
-
class Message
|
193
|
-
attr_reader :data, :descriptor, :headers
|
194
|
-
attr_writer :data, :descriptor, :headers
|
195
109
|
end
|
196
|
-
|
197
110
|
end
|