rubywmq 0.3.0-i386-mswin32-mq6
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +13 -0
- data/README +73 -0
- data/doc/classes/WMQ.html +6300 -0
- data/doc/classes/WMQ/Message.html +376 -0
- data/doc/classes/WMQ/Message.src/M000001.html +77 -0
- data/doc/classes/WMQ/Message.src/M000002.html +27 -0
- data/doc/classes/WMQ/Queue.html +1459 -0
- data/doc/classes/WMQ/Queue.src/M000003.html +205 -0
- data/doc/classes/WMQ/Queue.src/M000004.html +107 -0
- data/doc/classes/WMQ/Queue.src/M000005.html +198 -0
- data/doc/classes/WMQ/Queue.src/M000006.html +66 -0
- data/doc/classes/WMQ/Queue.src/M000007.html +203 -0
- data/doc/classes/WMQ/Queue.src/M000008.html +265 -0
- data/doc/classes/WMQ/Queue.src/M000009.html +120 -0
- data/doc/classes/WMQ/Queue.src/M000010.html +28 -0
- data/doc/classes/WMQ/Queue.src/M000011.html +30 -0
- data/doc/classes/WMQ/Queue.src/M000012.html +31 -0
- data/doc/classes/WMQ/Queue.src/M000013.html +31 -0
- data/doc/classes/WMQ/Queue.src/M000014.html +31 -0
- data/doc/classes/WMQ/QueueManager.html +1529 -0
- data/doc/classes/WMQ/QueueManager.src/M000015.html +182 -0
- data/doc/classes/WMQ/QueueManager.src/M000016.html +194 -0
- data/doc/classes/WMQ/QueueManager.src/M000017.html +92 -0
- data/doc/classes/WMQ/QueueManager.src/M000018.html +70 -0
- data/doc/classes/WMQ/QueueManager.src/M000019.html +49 -0
- data/doc/classes/WMQ/QueueManager.src/M000020.html +49 -0
- data/doc/classes/WMQ/QueueManager.src/M000021.html +63 -0
- data/doc/classes/WMQ/QueueManager.src/M000022.html +61 -0
- data/doc/classes/WMQ/QueueManager.src/M000023.html +65 -0
- data/doc/classes/WMQ/QueueManager.src/M000024.html +232 -0
- data/doc/classes/WMQ/QueueManager.src/M000025.html +30 -0
- data/doc/classes/WMQ/QueueManager.src/M000026.html +31 -0
- data/doc/classes/WMQ/QueueManager.src/M000027.html +31 -0
- data/doc/classes/WMQ/QueueManager.src/M000028.html +38 -0
- data/doc/classes/WMQ/QueueManager.src/M000029.html +33 -0
- data/doc/classes/WMQ/QueueManager.src/M000030.html +21 -0
- data/doc/classes/WMQ/QueueManager.src/M000031.html +284 -0
- data/doc/classes/WMQ/QueueManager.src/M000032.html +24 -0
- data/doc/classes/WMQ/QueueManager.src/M000033.html +18 -0
- data/doc/classes/WMQ/QueueManager.src/M000034.html +46 -0
- data/doc/classes/WMQ/QueueManager.src/M000035.html +27 -0
- data/doc/classes/WMQ/WMQException.html +111 -0
- data/doc/created.rid +1 -0
- data/doc/files/ext/lib/wmq_const_admin_rb.html +128 -0
- data/doc/files/ext/lib/wmq_const_rb.html +128 -0
- data/doc/files/ext/lib/wmq_temp_rb.html +122 -0
- data/doc/files/ext/wmq_c.html +101 -0
- data/doc/files/ext/wmq_message_c.html +101 -0
- data/doc/files/ext/wmq_queue_c.html +101 -0
- data/doc/files/ext/wmq_queue_manager_c.html +101 -0
- data/doc/fr_class_index.html +31 -0
- data/doc/fr_file_index.html +33 -0
- data/doc/fr_method_index.html +61 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/examples/each_a.rb +31 -0
- data/examples/each_b.rb +40 -0
- data/examples/each_header.rb +37 -0
- data/examples/files_to_q.cfg +24 -0
- data/examples/files_to_q.rb +46 -0
- data/examples/get_a.rb +34 -0
- data/examples/get_client.rb +50 -0
- data/examples/put1_a.rb +24 -0
- data/examples/put1_b.rb +32 -0
- data/examples/put1_c.rb +31 -0
- data/examples/put_a.rb +34 -0
- data/examples/put_b.rb +42 -0
- data/examples/put_dlh.rb +40 -0
- data/examples/put_dynamic_q.rb +37 -0
- data/examples/put_rfh.rb +66 -0
- data/examples/put_rfh2_a.rb +42 -0
- data/examples/put_rfh2_b.rb +42 -0
- data/examples/put_xmit_q.rb +32 -0
- data/examples/q_to_files.cfg +17 -0
- data/examples/q_to_files.rb +47 -0
- data/examples/request.rb +59 -0
- data/examples/server.rb +96 -0
- data/lib/wmq.rb +25 -0
- data/lib/wmq/wmq.so +0 -0
- data/lib/wmq/wmq_const.rb +745 -0
- data/lib/wmq/wmq_const_admin.rb +555 -0
- data/lib/wmq/wmq_temp.rb +197 -0
- data/tests/test.rb +299 -0
- metadata +131 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>clear (WMQ::Message)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre>/*
|
14
|
+
* Clear out the message data and headers
|
15
|
+
*
|
16
|
+
* Note:
|
17
|
+
* * The descriptor is not affected in any way
|
18
|
+
*/
|
19
|
+
VALUE Message_clear(VALUE self)
|
20
|
+
{
|
21
|
+
rb_iv_set(self, "@data", Qnil);
|
22
|
+
rb_iv_set(self, "@headers", rb_ary_new());
|
23
|
+
|
24
|
+
return self;
|
25
|
+
}</pre>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,1459 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: WMQ::Queue</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">WMQ::Queue</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/ext/wmq_c.html">
|
59
|
+
ext/wmq.c
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000006">close</a>
|
90
|
+
<a href="#M000011">comp_code</a>
|
91
|
+
<a href="#M000009">each</a>
|
92
|
+
<a href="#M000008">get</a>
|
93
|
+
<a href="#M000010">name</a>
|
94
|
+
<a href="#M000004">new</a>
|
95
|
+
<a href="#M000003">open</a>
|
96
|
+
<a href="#M000005">open</a>
|
97
|
+
<a href="#M000014">open?</a>
|
98
|
+
<a href="#M000007">put</a>
|
99
|
+
<a href="#M000013">reason</a>
|
100
|
+
<a href="#M000012">reason_code</a>
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if includes -->
|
108
|
+
|
109
|
+
<div id="section">
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<!-- if method_list -->
|
119
|
+
<div id="methods">
|
120
|
+
<h3 class="section-bar">Public Class methods</h3>
|
121
|
+
|
122
|
+
<div id="method-M000004" class="method-detail">
|
123
|
+
<a name="M000004"></a>
|
124
|
+
|
125
|
+
<div class="method-heading">
|
126
|
+
<a href="Queue.src/M000004.html" target="Code" class="method-signature"
|
127
|
+
onclick="popupCode('Queue.src/M000004.html');return false;">
|
128
|
+
<span class="method-name">new(...)<br />
|
129
|
+
</span>
|
130
|
+
</a>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div class="method-description">
|
134
|
+
<p>
|
135
|
+
Note:
|
136
|
+
</p>
|
137
|
+
<ul>
|
138
|
+
<li>It is <em>not</em> recommended to create instances of <a
|
139
|
+
href="Queue.html">Queue</a> directly, rather user <a
|
140
|
+
href="Queue.html#M000003">Queue.open</a>. Which creates the queue, opens
|
141
|
+
the queue, executes a supplied code block and then ensures the queue is
|
142
|
+
closed.
|
143
|
+
|
144
|
+
</li>
|
145
|
+
</ul>
|
146
|
+
<p>
|
147
|
+
Parameters:
|
148
|
+
</p>
|
149
|
+
<ul>
|
150
|
+
<li>Since the number of parameters can vary dramatically, all parameters are
|
151
|
+
passed by name in a hash
|
152
|
+
|
153
|
+
</li>
|
154
|
+
<li>See <a href="Queue.html#M000003">Queue.open</a> for details on all
|
155
|
+
parameters
|
156
|
+
|
157
|
+
</li>
|
158
|
+
</ul>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div id="method-M000003" class="method-detail">
|
163
|
+
<a name="M000003"></a>
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<a href="Queue.src/M000003.html" target="Code" class="method-signature"
|
167
|
+
onclick="popupCode('Queue.src/M000003.html');return false;">
|
168
|
+
<span class="method-name">open(...)<br />
|
169
|
+
</span>
|
170
|
+
</a>
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<div class="method-description">
|
174
|
+
<p>
|
175
|
+
Open a queue, then close the queue once the supplied code block completes
|
176
|
+
</p>
|
177
|
+
<p>
|
178
|
+
Parameters:
|
179
|
+
</p>
|
180
|
+
<ul>
|
181
|
+
<li>Since the number of parameters can vary dramatically, all parameters are
|
182
|
+
passed by name in a hash
|
183
|
+
|
184
|
+
</li>
|
185
|
+
<li>Summary of parameters and their WebSphere MQ equivalents:
|
186
|
+
|
187
|
+
</li>
|
188
|
+
</ul>
|
189
|
+
<pre>
|
190
|
+
queue = Queue.new( # WebSphere MQ Equivalents:
|
191
|
+
:queue_manager => queue_manager, # n/a : Instance of QueueManager
|
192
|
+
:q_name => 'Queue Name', # MQOD.ObjectName
|
193
|
+
:q_name => { queue_manager=>'QMGR_name', # MQOD.ObjectQMgrName
|
194
|
+
q_name =>'q_name'}
|
195
|
+
:mode => :input or :input_shared or :input_exclusive or :output,
|
196
|
+
:fail_if_quiescing => true # MQOO_FAIL_IF_QUIESCING
|
197
|
+
:fail_if_exists => true, # For dynamic queues, fail if it already exists
|
198
|
+
:open_options => WMQ::MQOO_BIND_ON_OPEN | ... # MQOO_*
|
199
|
+
:close_options => WMQ::MQCO_DELETE_PURGE # MQCO_*
|
200
|
+
:dynamic_q_name => 'Name of Dynamic Queue' # MQOD.DynamicQName
|
201
|
+
:alternate_user_id => 'userid', # MQOD.AlternateUserId
|
202
|
+
:alternate_security_id => '' # MQOD.AlternateSecurityId
|
203
|
+
)
|
204
|
+
</pre>
|
205
|
+
<p>
|
206
|
+
Mandatory Parameters
|
207
|
+
</p>
|
208
|
+
<ul>
|
209
|
+
<li>:queue_manager
|
210
|
+
|
211
|
+
<ul>
|
212
|
+
<li>An instance of the <a href="QueueManager.html">WMQ::QueueManager</a> class.
|
213
|
+
E.g. <a href="QueueManager.html#M000016">QueueManager.new</a>
|
214
|
+
|
215
|
+
</li>
|
216
|
+
<li>Note: This is <em>not</em> the queue manager name!
|
217
|
+
|
218
|
+
</li>
|
219
|
+
</ul>
|
220
|
+
</li>
|
221
|
+
<li>:q_name => String
|
222
|
+
|
223
|
+
<ul>
|
224
|
+
<li>Name of the existing WebSphere MQ local queue, model queue or remote queue
|
225
|
+
to open
|
226
|
+
|
227
|
+
</li>
|
228
|
+
<li>To open remote queues for which a local remote queue definition is not
|
229
|
+
available pass a Hash as q_name (see q_name => Hash)
|
230
|
+
|
231
|
+
<pre>
|
232
|
+
OR
|
233
|
+
</pre>
|
234
|
+
</li>
|
235
|
+
</ul>
|
236
|
+
</li>
|
237
|
+
<li>:q_name => Hash
|
238
|
+
|
239
|
+
<ul>
|
240
|
+
<li>q_name => String
|
241
|
+
|
242
|
+
<ul>
|
243
|
+
<li>Name of the existing WebSphere MQ local queue, model queue or remote queue
|
244
|
+
to open
|
245
|
+
|
246
|
+
</li>
|
247
|
+
</ul>
|
248
|
+
</li>
|
249
|
+
<li>:q_mgr_name => String
|
250
|
+
|
251
|
+
<ul>
|
252
|
+
<li>Name of the remote WebSphere MQ queue manager to send the message to.
|
253
|
+
|
254
|
+
</li>
|
255
|
+
<li>This allows a message to be written to a queue on a remote queue manager
|
256
|
+
where a remote queue definition is not defined locally
|
257
|
+
|
258
|
+
</li>
|
259
|
+
<li>Commonly used to reply to messages from remote systems
|
260
|
+
|
261
|
+
</li>
|
262
|
+
<li>If q_mgr_name is the same as the local queue manager name then the message
|
263
|
+
is merely written to the local queue.
|
264
|
+
|
265
|
+
</li>
|
266
|
+
<li>Note: q_mgr_name should only be supplied when putting messages to the
|
267
|
+
queue.
|
268
|
+
|
269
|
+
<pre>
|
270
|
+
It is not possible to get messages from a queue on a queue manager other
|
271
|
+
than the currently connected queue manager
|
272
|
+
</pre>
|
273
|
+
</li>
|
274
|
+
</ul>
|
275
|
+
</li>
|
276
|
+
</ul>
|
277
|
+
</li>
|
278
|
+
<li>:mode => Symbol
|
279
|
+
|
280
|
+
<ul>
|
281
|
+
<li>Specify how the queue is to be opened
|
282
|
+
|
283
|
+
<ul>
|
284
|
+
<li>:output
|
285
|
+
|
286
|
+
<ul>
|
287
|
+
<li>Open the queue for output. I.e. <a
|
288
|
+
href="Queue.html#M000007">WMQ::Queue#put</a> will be called
|
289
|
+
|
290
|
+
<pre>
|
291
|
+
Equivalent to: MQOO_OUTPUT
|
292
|
+
</pre>
|
293
|
+
</li>
|
294
|
+
</ul>
|
295
|
+
</li>
|
296
|
+
<li>:input
|
297
|
+
|
298
|
+
<ul>
|
299
|
+
<li>Open the queue for input. I.e. <a
|
300
|
+
href="Queue.html#M000008">WMQ::Queue#get</a> will be called.
|
301
|
+
|
302
|
+
</li>
|
303
|
+
<li><a href="Queue.html">Queue</a> sharing for reading from the queue is
|
304
|
+
defined by the queue itself. By default most queues are set to shared. I.e.
|
305
|
+
Multiple applications can read and/or write from the queue at the same time
|
306
|
+
|
307
|
+
<pre>
|
308
|
+
Equivalent to: MQOO_INPUT_AS_Q_DEF
|
309
|
+
</pre>
|
310
|
+
</li>
|
311
|
+
</ul>
|
312
|
+
</li>
|
313
|
+
<li>:input_shared
|
314
|
+
|
315
|
+
<ul>
|
316
|
+
<li>Open the queue for input. I.e. <a
|
317
|
+
href="Queue.html#M000008">WMQ::Queue#get</a> will be called.
|
318
|
+
|
319
|
+
</li>
|
320
|
+
<li>Explicitly open the queue so that other applications can read or write from
|
321
|
+
the same queue
|
322
|
+
|
323
|
+
<pre>
|
324
|
+
Equivalent to: MQOO_INPUT_SHARED
|
325
|
+
</pre>
|
326
|
+
</li>
|
327
|
+
</ul>
|
328
|
+
</li>
|
329
|
+
<li>:input_exclusive
|
330
|
+
|
331
|
+
<ul>
|
332
|
+
<li>Open the queue for input. I.e. <a
|
333
|
+
href="Queue.html#M000008">WMQ::Queue#get</a> will be called.
|
334
|
+
|
335
|
+
</li>
|
336
|
+
<li>Explicitly open the queue so that other applications cannot read from the
|
337
|
+
same queue. Does <em>not</em> affect applications writing to the queue.
|
338
|
+
|
339
|
+
</li>
|
340
|
+
<li>Note: If :input_exclusive is used and connectivity the queue manager is
|
341
|
+
lost. Upon restart the queue can still be "locked". The
|
342
|
+
application should retry every minute or so until the queue becomes
|
343
|
+
available. Otherwise, of course, another application has the queue open
|
344
|
+
exclusively.
|
345
|
+
|
346
|
+
<pre>
|
347
|
+
Equivalent to: MQOO_INPUT_EXCLUSIVE
|
348
|
+
</pre>
|
349
|
+
</li>
|
350
|
+
</ul>
|
351
|
+
</li>
|
352
|
+
<li>:browse
|
353
|
+
|
354
|
+
<ul>
|
355
|
+
<li>Browse the messages on the queue <em>without</em> removing them from the
|
356
|
+
queue
|
357
|
+
|
358
|
+
</li>
|
359
|
+
<li>Open the queue for input. I.e. <a
|
360
|
+
href="Queue.html#M000008">WMQ::Queue#get</a> will be called.
|
361
|
+
|
362
|
+
</li>
|
363
|
+
<li>Note: It is necessary to specify WMQ::MQGMO_BROWSE_FIRST before the first
|
364
|
+
get, then set WMQ::MQGMO_BROWSE_NEXT for subsequent calls.
|
365
|
+
|
366
|
+
</li>
|
367
|
+
<li>Note: For now it is also necessary to specify these options when calling <a
|
368
|
+
href="Queue.html#M000009">WMQ::Queue#each</a>. A change will be made to
|
369
|
+
each to address this.
|
370
|
+
|
371
|
+
<pre>
|
372
|
+
Equivalent to: MQOO_BROWSE
|
373
|
+
</pre>
|
374
|
+
</li>
|
375
|
+
</ul>
|
376
|
+
</li>
|
377
|
+
</ul>
|
378
|
+
</li>
|
379
|
+
</ul>
|
380
|
+
</li>
|
381
|
+
</ul>
|
382
|
+
<p>
|
383
|
+
Optional Parameters
|
384
|
+
</p>
|
385
|
+
<ul>
|
386
|
+
<li>:fail_if_quiescing => true or false
|
387
|
+
|
388
|
+
<ul>
|
389
|
+
<li>Determines whether the <a href="Queue.html#M000003">WMQ::Queue#open</a>
|
390
|
+
call will fail if the queue manager is in the process of being quiesced.
|
391
|
+
|
392
|
+
</li>
|
393
|
+
<li>Note: If set to false, the MQOO_FAIL_IF_QUIESCING flag will not be removed
|
394
|
+
if it was also supplied in :open_options. However, if set to true it will
|
395
|
+
override this value in :open_options
|
396
|
+
|
397
|
+
</li>
|
398
|
+
<li>Note: This interface differs from other WebSphere MQ interfaces, they do
|
399
|
+
not default to true.
|
400
|
+
|
401
|
+
<pre>
|
402
|
+
Default: true
|
403
|
+
Equivalent to: MQOO_FAIL_IF_QUIESCING
|
404
|
+
</pre>
|
405
|
+
</li>
|
406
|
+
</ul>
|
407
|
+
</li>
|
408
|
+
<li>:open_options => FixNum
|
409
|
+
|
410
|
+
<ul>
|
411
|
+
<li>One or more of the following values:
|
412
|
+
|
413
|
+
<pre>
|
414
|
+
WMQ::MQOO_INQUIRE
|
415
|
+
WMQ::MQOO_SET
|
416
|
+
WMQ::MQOO_BIND_ON_OPEN
|
417
|
+
WMQ::MQOO_BIND_NOT_FIXED
|
418
|
+
WMQ::MQOO_BIND_AS_Q_DEF
|
419
|
+
WMQ::MQOO_SAVE_ALL_CONTEXT
|
420
|
+
WMQ::MQOO_PASS_IDENTITY_CONTEXT
|
421
|
+
WMQ::MQOO_PASS_ALL_CONTEXT
|
422
|
+
WMQ::MQOO_SET_IDENTITY_CONTEXT
|
423
|
+
WMQ::MQOO_SET_ALL_CONTEXT
|
424
|
+
</pre>
|
425
|
+
</li>
|
426
|
+
<li>Multiple values can be or’d together. E.g.
|
427
|
+
|
428
|
+
<pre>
|
429
|
+
:open_options=>WMQ::MQOO_BIND_ON_OPEN | WMQ::MQOO_SAVE_ALL_CONTEXT
|
430
|
+
</pre>
|
431
|
+
</li>
|
432
|
+
<li>Please see the WebSphere MQ documentation for more details on the above
|
433
|
+
options
|
434
|
+
|
435
|
+
</li>
|
436
|
+
</ul>
|
437
|
+
</li>
|
438
|
+
<li>:close_options => FixNum
|
439
|
+
|
440
|
+
<ul>
|
441
|
+
<li>One of the following values:
|
442
|
+
|
443
|
+
<pre>
|
444
|
+
WMQ::MQCO_DELETE
|
445
|
+
WMQ::MQCO_DELETE_PURGE
|
446
|
+
</pre>
|
447
|
+
</li>
|
448
|
+
<li>Please see the WebSphere MQ documentation for more details on the above
|
449
|
+
options
|
450
|
+
|
451
|
+
</li>
|
452
|
+
</ul>
|
453
|
+
</li>
|
454
|
+
<li>:dynamic_q_name => String
|
455
|
+
|
456
|
+
<ul>
|
457
|
+
<li>If a model queue name is supplied to :q_name then the final queue name that
|
458
|
+
is created is specified using :dynamic_q_name
|
459
|
+
|
460
|
+
</li>
|
461
|
+
<li>A complete queue name can be specified. E.g. ‘MY.LOCAL.QUEUE‘
|
462
|
+
|
463
|
+
</li>
|
464
|
+
<li>Or, a partial queue name can be supplied. E.g.
|
465
|
+
‘MY.REPLY.QUEUE.*’ In this case WebSphere MQ will automatically
|
466
|
+
add numbers to the end of ‘MY.REPLY.QUEUE.’ to ensure this
|
467
|
+
queue name is unique.
|
468
|
+
|
469
|
+
</li>
|
470
|
+
<li>The most common use of :dynamic_q_name is to create a temporary dynamic
|
471
|
+
queue to which replies can be posted for this instance of the program
|
472
|
+
|
473
|
+
</li>
|
474
|
+
<li>When opening a model queue, :dynamic_q_name is optional. However it’s
|
475
|
+
use is recommended in order to make it easier to identify which application
|
476
|
+
a dynamic queue belongs to.
|
477
|
+
|
478
|
+
</li>
|
479
|
+
</ul>
|
480
|
+
</li>
|
481
|
+
<li>:fail_if_exists => true or false
|
482
|
+
|
483
|
+
<ul>
|
484
|
+
<li>Only applicable when opening a model queue
|
485
|
+
|
486
|
+
</li>
|
487
|
+
<li>When opening a queue dynamically, sometimes the :dynamic_q_name already
|
488
|
+
exists. Under this condition, if :fail_if_exists is false, the queue is
|
489
|
+
automatically re-opened using the :dynamic_q_name. The :q_name field is
|
490
|
+
ignored.
|
491
|
+
|
492
|
+
</li>
|
493
|
+
<li>This feature is usefull when creating <em>permanent</em> dynamic queues.
|
494
|
+
(The model queue has the definition type set to Permanent: DEFTYPE(PERMDYN)
|
495
|
+
).
|
496
|
+
|
497
|
+
<ul>
|
498
|
+
<li>In this way it is not necessary to create the queues before running the
|
499
|
+
program.
|
500
|
+
|
501
|
+
</li>
|
502
|
+
</ul>
|
503
|
+
<pre>
|
504
|
+
Default: true
|
505
|
+
</pre>
|
506
|
+
</li>
|
507
|
+
</ul>
|
508
|
+
</li>
|
509
|
+
<li>:alternate_user_id [String]
|
510
|
+
|
511
|
+
<ul>
|
512
|
+
<li>Sets the alternate userid to use when messages are put to the queue
|
513
|
+
|
514
|
+
</li>
|
515
|
+
<li>Note: It is not necessary to supply WMQ::MQOO_ALTERNATE_USER_AUTHORITY
|
516
|
+
since it is automatically added to the :open_options when
|
517
|
+
:alternate_user_id is supplied
|
518
|
+
|
519
|
+
</li>
|
520
|
+
<li>See WebSphere MQ Application Programming Reference: MQOD.AlternateUserId
|
521
|
+
|
522
|
+
</li>
|
523
|
+
</ul>
|
524
|
+
</li>
|
525
|
+
<li>:alternate_security_id [String]
|
526
|
+
|
527
|
+
<ul>
|
528
|
+
<li>Sets the alternate security id to use when messages are put to the queue
|
529
|
+
|
530
|
+
</li>
|
531
|
+
<li>See WebSphere MQ Application Programming Reference:
|
532
|
+
MQOD.AlternateSecurityId
|
533
|
+
|
534
|
+
</li>
|
535
|
+
</ul>
|
536
|
+
</li>
|
537
|
+
</ul>
|
538
|
+
<p>
|
539
|
+
Note:
|
540
|
+
</p>
|
541
|
+
<ul>
|
542
|
+
<li>It is more convenient to use <a
|
543
|
+
href="QueueManager.html#M000019">WMQ::QueueManager#open_queue</a>, since it
|
544
|
+
automatically supplies the parameter :queue_manager
|
545
|
+
|
546
|
+
</li>
|
547
|
+
<li>That way :queue_manager parameter is <em>not</em> required
|
548
|
+
|
549
|
+
</li>
|
550
|
+
</ul>
|
551
|
+
<p>
|
552
|
+
Example:
|
553
|
+
</p>
|
554
|
+
<pre>
|
555
|
+
# Put 10 Hello World messages onto a queue
|
556
|
+
require 'wmq/wmq_client'
|
557
|
+
|
558
|
+
WMQ::QueueManager.connect(:q_mgr_name=>'REID', :connection_name=>'localhost(1414)') do |qmgr|
|
559
|
+
WMQ::Queue.open(:queue_manager=>qmgr,
|
560
|
+
:q_name =>'TEST.QUEUE',
|
561
|
+
:mode =>:output) do |queue|
|
562
|
+
10.times { |counter| queue.put(:data => "Hello World #{counter}") }
|
563
|
+
end
|
564
|
+
end
|
565
|
+
</pre>
|
566
|
+
</div>
|
567
|
+
</div>
|
568
|
+
|
569
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
570
|
+
|
571
|
+
<div id="method-M000006" class="method-detail">
|
572
|
+
<a name="M000006"></a>
|
573
|
+
|
574
|
+
<div class="method-heading">
|
575
|
+
<a href="Queue.src/M000006.html" target="Code" class="method-signature"
|
576
|
+
onclick="popupCode('Queue.src/M000006.html');return false;">
|
577
|
+
<span class="method-name">close</span><span class="method-args">()</span>
|
578
|
+
</a>
|
579
|
+
</div>
|
580
|
+
|
581
|
+
<div class="method-description">
|
582
|
+
<p>
|
583
|
+
Close the queue
|
584
|
+
</p>
|
585
|
+
<p>
|
586
|
+
Returns:
|
587
|
+
</p>
|
588
|
+
<ul>
|
589
|
+
<li>true : On Success
|
590
|
+
|
591
|
+
</li>
|
592
|
+
<li>false: On Failure
|
593
|
+
|
594
|
+
<p>
|
595
|
+
<a href="Queue.html#M000011">comp_code</a> and <a
|
596
|
+
href="Queue.html#M000012">reason_code</a> are also updated. reason will
|
597
|
+
return a text description of the <a
|
598
|
+
href="Queue.html#M000012">reason_code</a>
|
599
|
+
</p>
|
600
|
+
</li>
|
601
|
+
</ul>
|
602
|
+
<p>
|
603
|
+
Throws:
|
604
|
+
</p>
|
605
|
+
<ul>
|
606
|
+
<li><a href="WMQException.html">WMQ::WMQException</a> if <a
|
607
|
+
href="Queue.html#M000011">comp_code</a> == MQCC_FAILED
|
608
|
+
|
609
|
+
</li>
|
610
|
+
<li>Except if :exception_on_error => false was supplied as a parameter to <a
|
611
|
+
href="QueueManager.html#M000016">QueueManager.new</a>
|
612
|
+
|
613
|
+
</li>
|
614
|
+
</ul>
|
615
|
+
</div>
|
616
|
+
</div>
|
617
|
+
|
618
|
+
<div id="method-M000011" class="method-detail">
|
619
|
+
<a name="M000011"></a>
|
620
|
+
|
621
|
+
<div class="method-heading">
|
622
|
+
<a href="Queue.src/M000011.html" target="Code" class="method-signature"
|
623
|
+
onclick="popupCode('Queue.src/M000011.html');return false;">
|
624
|
+
<span class="method-name">comp_code</span><span class="method-args">()</span>
|
625
|
+
</a>
|
626
|
+
</div>
|
627
|
+
|
628
|
+
<div class="method-description">
|
629
|
+
<p>
|
630
|
+
Return the completion code for the last MQ operation on this queue instance
|
631
|
+
</p>
|
632
|
+
<p>
|
633
|
+
Returns => FixNum
|
634
|
+
</p>
|
635
|
+
<ul>
|
636
|
+
<li>WMQ::MQCC_OK 0
|
637
|
+
|
638
|
+
</li>
|
639
|
+
<li>WMQ::MQCC_WARNING 1
|
640
|
+
|
641
|
+
</li>
|
642
|
+
<li>WMQ::MQCC_FAILED 2
|
643
|
+
|
644
|
+
</li>
|
645
|
+
<li>WMQ::MQCC_UNKNOWN -1
|
646
|
+
|
647
|
+
</li>
|
648
|
+
</ul>
|
649
|
+
</div>
|
650
|
+
</div>
|
651
|
+
|
652
|
+
<div id="method-M000009" class="method-detail">
|
653
|
+
<a name="M000009"></a>
|
654
|
+
|
655
|
+
<div class="method-heading">
|
656
|
+
<a href="Queue.src/M000009.html" target="Code" class="method-signature"
|
657
|
+
onclick="popupCode('Queue.src/M000009.html');return false;">
|
658
|
+
<span class="method-name">each</span><span class="method-args">(...)</span>
|
659
|
+
</a>
|
660
|
+
</div>
|
661
|
+
|
662
|
+
<div class="method-description">
|
663
|
+
<p>
|
664
|
+
For each message found on the queue, the supplied block is executed
|
665
|
+
</p>
|
666
|
+
<p>
|
667
|
+
Note:
|
668
|
+
</p>
|
669
|
+
<ul>
|
670
|
+
<li>If no messages are found on the queue during the supplied wait interval,
|
671
|
+
then the supplied block will not be called at all
|
672
|
+
|
673
|
+
</li>
|
674
|
+
<li>If :mode=>:browse is supplied when opening the queue then <a
|
675
|
+
href="Queue.html#M000009">Queue#each</a> will automatically set
|
676
|
+
MQGMO_BROWSE_FIRST and MQGMO_BROWSE_NEXT as required
|
677
|
+
|
678
|
+
</li>
|
679
|
+
</ul>
|
680
|
+
<p>
|
681
|
+
Returns:
|
682
|
+
</p>
|
683
|
+
<ul>
|
684
|
+
<li>true: If at least one message was succesfully processed
|
685
|
+
|
686
|
+
</li>
|
687
|
+
<li>false: If no messages were retrieved from the queue
|
688
|
+
|
689
|
+
</li>
|
690
|
+
</ul>
|
691
|
+
<p>
|
692
|
+
Example:
|
693
|
+
</p>
|
694
|
+
<pre>
|
695
|
+
require 'wmq/wmq'
|
696
|
+
|
697
|
+
WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
|
698
|
+
qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:input) do |queue|
|
699
|
+
queue.each do |message|
|
700
|
+
puts "Data Received: #{message.data}"
|
701
|
+
end
|
702
|
+
end
|
703
|
+
puts 'Completed.'
|
704
|
+
end
|
705
|
+
</pre>
|
706
|
+
</div>
|
707
|
+
</div>
|
708
|
+
|
709
|
+
<div id="method-M000008" class="method-detail">
|
710
|
+
<a name="M000008"></a>
|
711
|
+
|
712
|
+
<div class="method-heading">
|
713
|
+
<a href="Queue.src/M000008.html" target="Code" class="method-signature"
|
714
|
+
onclick="popupCode('Queue.src/M000008.html');return false;">
|
715
|
+
<span class="method-name">get(...)<br />
|
716
|
+
</span>
|
717
|
+
</a>
|
718
|
+
</div>
|
719
|
+
|
720
|
+
<div class="method-description">
|
721
|
+
<p>
|
722
|
+
Get a message from the opened queue
|
723
|
+
</p>
|
724
|
+
<p>
|
725
|
+
Parameters:
|
726
|
+
</p>
|
727
|
+
<ul>
|
728
|
+
<li>a Hash consisting of one or more of the named parameters
|
729
|
+
|
730
|
+
</li>
|
731
|
+
<li>Summary of parameters and their WebSphere MQ equivalents:
|
732
|
+
|
733
|
+
</li>
|
734
|
+
</ul>
|
735
|
+
<pre>
|
736
|
+
queue.get( # WebSphere MQ Equivalents:
|
737
|
+
:message => my_message, # n/a : Instance of Message
|
738
|
+
:sync => false, # MQGMO_SYNCPOINT
|
739
|
+
:wait => 0, # MQGMO_WAIT, duration in ms
|
740
|
+
:match => WMQ::MQMO_NONE, # MQMO_*
|
741
|
+
:convert => false, # MQGMO_CONVERT
|
742
|
+
:fail_if_quiescing => true # MQOO_FAIL_IF_QUIESCING
|
743
|
+
:options => WMQ::MQGMO_FAIL_IF_QUIESCING # MQGMO_*
|
744
|
+
)
|
745
|
+
</pre>
|
746
|
+
<p>
|
747
|
+
Mandatory Parameters
|
748
|
+
</p>
|
749
|
+
<ul>
|
750
|
+
<li>:message => <a href="Message.html">Message</a>
|
751
|
+
|
752
|
+
<ul>
|
753
|
+
<li>An instance of the <a href="Message.html">WMQ::Message</a>
|
754
|
+
|
755
|
+
</li>
|
756
|
+
</ul>
|
757
|
+
</li>
|
758
|
+
</ul>
|
759
|
+
<p>
|
760
|
+
Optional Parameters
|
761
|
+
</p>
|
762
|
+
<ul>
|
763
|
+
<li>:sync => true or false
|
764
|
+
|
765
|
+
<ul>
|
766
|
+
<li>Determines whether the get is performed under synchpoint. I.e. Under the
|
767
|
+
current unit of work
|
768
|
+
|
769
|
+
<pre>
|
770
|
+
Default: false
|
771
|
+
</pre>
|
772
|
+
</li>
|
773
|
+
</ul>
|
774
|
+
</li>
|
775
|
+
<li>:wait => FixNum
|
776
|
+
|
777
|
+
<ul>
|
778
|
+
<li>The time in milli-seconds to wait for a message if one is not immediately
|
779
|
+
available on the queue
|
780
|
+
|
781
|
+
</li>
|
782
|
+
<li>Note: Under the covers the put option MQGMO_WAIT is automatically set when
|
783
|
+
:wait is supplied
|
784
|
+
|
785
|
+
<pre>
|
786
|
+
Default: Wait forever
|
787
|
+
</pre>
|
788
|
+
</li>
|
789
|
+
</ul>
|
790
|
+
</li>
|
791
|
+
<li>:match => FixNum
|
792
|
+
|
793
|
+
<ul>
|
794
|
+
<li>One or more of the following values:
|
795
|
+
|
796
|
+
<pre>
|
797
|
+
WMQ::MQMO_MATCH_MSG_ID
|
798
|
+
WMQ::MQMO_MATCH_CORREL_ID
|
799
|
+
WMQ::MQMO_MATCH_GROUP_ID
|
800
|
+
WMQ::MQMO_MATCH_MSG_SEQ_NUMBER
|
801
|
+
WMQ::MQMO_MATCH_OFFSET
|
802
|
+
WMQ::MQMO_MATCH_MSG_TOKEN
|
803
|
+
WMQ::MQMO_NONE
|
804
|
+
</pre>
|
805
|
+
</li>
|
806
|
+
<li>Multiple values can be or’d together. E.g.
|
807
|
+
|
808
|
+
<pre>
|
809
|
+
:match=>WMQ::MQMO_MATCH_MSG_ID | WMQ::MQMO_MATCH_CORREL_ID
|
810
|
+
</pre>
|
811
|
+
</li>
|
812
|
+
<li>Please see the WebSphere MQ documentation for more details on the above
|
813
|
+
options
|
814
|
+
|
815
|
+
<pre>
|
816
|
+
Default: WMQ::MQMO_MATCH_MSG_ID | WMQ::MQMO_MATCH_CORREL_ID
|
817
|
+
</pre>
|
818
|
+
</li>
|
819
|
+
</ul>
|
820
|
+
</li>
|
821
|
+
<li>:convert => true or false
|
822
|
+
|
823
|
+
<ul>
|
824
|
+
<li>When true, convert results in messages being converted to the local code
|
825
|
+
page. E.g. When an EBCDIC text message from a mainframe is received, it
|
826
|
+
will be converted to ASCII before passing the message data to the
|
827
|
+
application.
|
828
|
+
|
829
|
+
<pre>
|
830
|
+
Default: false
|
831
|
+
</pre>
|
832
|
+
</li>
|
833
|
+
</ul>
|
834
|
+
</li>
|
835
|
+
<li>:fail_if_quiescing => true or false
|
836
|
+
|
837
|
+
<ul>
|
838
|
+
<li>Determines whether the <a href="Queue.html#M000008">WMQ::Queue#get</a> call
|
839
|
+
will fail if the queue manager is in the process of being quiesced.
|
840
|
+
|
841
|
+
</li>
|
842
|
+
<li>Note: This interface differs from other WebSphere MQ interfaces, they do
|
843
|
+
not default to true.
|
844
|
+
|
845
|
+
<pre>
|
846
|
+
Default: true
|
847
|
+
</pre>
|
848
|
+
</li>
|
849
|
+
</ul>
|
850
|
+
</li>
|
851
|
+
<li>:options => Fixnum (Advanced MQ Use only)
|
852
|
+
|
853
|
+
<ul>
|
854
|
+
<li>Numeric field containing any of the MQ Get message options or’d
|
855
|
+
together
|
856
|
+
|
857
|
+
<ul>
|
858
|
+
<li>E.g. :options => WMQ::MQGMO_SYNCPOINT_IF_PERSISTENT |
|
859
|
+
WMQ::MQGMO_MARK_SKIP_BACKOUT
|
860
|
+
|
861
|
+
</li>
|
862
|
+
</ul>
|
863
|
+
</li>
|
864
|
+
<li>Note: If :options is supplied, it is applied first, then the above
|
865
|
+
parameters are applied afterwards.
|
866
|
+
|
867
|
+
</li>
|
868
|
+
<li>One or more of the following values:
|
869
|
+
|
870
|
+
<pre>
|
871
|
+
WMQ::MQGMO_SYNCPOINT_IF_PERSISTENT
|
872
|
+
WMQ::MQGMO_NO_SYNCPOINT
|
873
|
+
WMQ::MQGMO_MARK_SKIP_BACKOUT
|
874
|
+
WMQ::MQGMO_BROWSE_FIRST
|
875
|
+
WMQ::MQGMO_BROWSE_NEXT
|
876
|
+
WMQ::MQGMO_BROWSE_MSG_UNDER_CURSOR
|
877
|
+
WMQ::MQGMO_MSG_UNDER_CURSOR
|
878
|
+
WMQ::MQGMO_LOCK
|
879
|
+
WMQ::MQGMO_UNLOCK
|
880
|
+
WMQ::MQGMO_LOGICAL_ORDER
|
881
|
+
WMQ::MQGMO_COMPLETE_MSG
|
882
|
+
WMQ::MQGMO_ALL_MSGS_AVAILABLE
|
883
|
+
WMQ::MQGMO_ALL_SEGMENTS_AVAILABLE
|
884
|
+
WMQ::MQGMO_DELETE_MSG
|
885
|
+
WMQ::MQGMO_NONE
|
886
|
+
</pre>
|
887
|
+
</li>
|
888
|
+
<li>Please see the WebSphere MQ documentation for more details on the above
|
889
|
+
options
|
890
|
+
|
891
|
+
<pre>
|
892
|
+
Default: WMQ::MQGMO_NONE
|
893
|
+
</pre>
|
894
|
+
</li>
|
895
|
+
</ul>
|
896
|
+
</li>
|
897
|
+
</ul>
|
898
|
+
<p>
|
899
|
+
Returns:
|
900
|
+
</p>
|
901
|
+
<ul>
|
902
|
+
<li>true : On Success
|
903
|
+
|
904
|
+
</li>
|
905
|
+
<li>false: On Failure, or if no message was found on the queue during the wait
|
906
|
+
interval
|
907
|
+
|
908
|
+
<p>
|
909
|
+
<a href="Queue.html#M000011">comp_code</a> and <a
|
910
|
+
href="Queue.html#M000012">reason_code</a> are also updated. reason will
|
911
|
+
return a text description of the <a
|
912
|
+
href="Queue.html#M000012">reason_code</a>
|
913
|
+
</p>
|
914
|
+
</li>
|
915
|
+
</ul>
|
916
|
+
<p>
|
917
|
+
Throws:
|
918
|
+
</p>
|
919
|
+
<ul>
|
920
|
+
<li><a href="WMQException.html">WMQ::WMQException</a> if <a
|
921
|
+
href="Queue.html#M000011">comp_code</a> == MQCC_FAILED
|
922
|
+
|
923
|
+
</li>
|
924
|
+
<li>Except if :exception_on_error => false was supplied as a parameter to <a
|
925
|
+
href="QueueManager.html#M000016">QueueManager.new</a>
|
926
|
+
|
927
|
+
</li>
|
928
|
+
</ul>
|
929
|
+
<p>
|
930
|
+
Example:
|
931
|
+
</p>
|
932
|
+
<pre>
|
933
|
+
require 'wmq/wmq'
|
934
|
+
|
935
|
+
WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
|
936
|
+
qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:input) do |queue|
|
937
|
+
message = WMQ::Message.new
|
938
|
+
if queue.get(:message => message)
|
939
|
+
puts "Data Received: #{message.data}"
|
940
|
+
else
|
941
|
+
puts 'No message available'
|
942
|
+
end
|
943
|
+
end
|
944
|
+
end
|
945
|
+
</pre>
|
946
|
+
</div>
|
947
|
+
</div>
|
948
|
+
|
949
|
+
<div id="method-M000010" class="method-detail">
|
950
|
+
<a name="M000010"></a>
|
951
|
+
|
952
|
+
<div class="method-heading">
|
953
|
+
<a href="Queue.src/M000010.html" target="Code" class="method-signature"
|
954
|
+
onclick="popupCode('Queue.src/M000010.html');return false;">
|
955
|
+
<span class="method-name">name</span><span class="method-args">()</span>
|
956
|
+
</a>
|
957
|
+
</div>
|
958
|
+
|
959
|
+
<div class="method-description">
|
960
|
+
<p>
|
961
|
+
Returns the queue name => String
|
962
|
+
</p>
|
963
|
+
</div>
|
964
|
+
</div>
|
965
|
+
|
966
|
+
<div id="method-M000005" class="method-detail">
|
967
|
+
<a name="M000005"></a>
|
968
|
+
|
969
|
+
<div class="method-heading">
|
970
|
+
<a href="Queue.src/M000005.html" target="Code" class="method-signature"
|
971
|
+
onclick="popupCode('Queue.src/M000005.html');return false;">
|
972
|
+
<span class="method-name">open()<br />
|
973
|
+
</span>
|
974
|
+
</a>
|
975
|
+
</div>
|
976
|
+
|
977
|
+
<div class="method-description">
|
978
|
+
<p>
|
979
|
+
Open the queue
|
980
|
+
</p>
|
981
|
+
<p>
|
982
|
+
Note:
|
983
|
+
</p>
|
984
|
+
<ul>
|
985
|
+
<li>It is not recommended to use this method to open a queue, since the queue
|
986
|
+
will have to be closed explicitly.
|
987
|
+
|
988
|
+
</li>
|
989
|
+
<li>Rather use <a
|
990
|
+
href="QueueManager.html#M000019">WMQ::QueueManager#open_queue</a>
|
991
|
+
|
992
|
+
</li>
|
993
|
+
<li>If the queue is already open, it will be closed and re-opened. Any errors
|
994
|
+
that occur while closing the queue are ignored.
|
995
|
+
|
996
|
+
</li>
|
997
|
+
<li>Custom behavior for Dynamic Queues:
|
998
|
+
|
999
|
+
<pre>
|
1000
|
+
When :dynamic_q_name is supplied and MQ fails to
|
1001
|
+
open the queue with MQRC_OBJECT_ALREADY_EXISTS,
|
1002
|
+
this method will automatically open the existing
|
1003
|
+
queue by replacing the queue name with :dynamic_q_name
|
1004
|
+
|
1005
|
+
This technique allows programs to dynamically create
|
1006
|
+
queues, without being concerned with first checking if
|
1007
|
+
the queue is already defined.
|
1008
|
+
I.e. Removes the need to have to explicitly create
|
1009
|
+
required queues in advance
|
1010
|
+
However, in order for this approach to work a
|
1011
|
+
Permanent model queue must be used. A Temporary
|
1012
|
+
model queue is automatically erased by WMQ when the
|
1013
|
+
queue is closed.
|
1014
|
+
|
1015
|
+
Persistent messages cannot be put to a
|
1016
|
+
temporary dynamic queue!
|
1017
|
+
</pre>
|
1018
|
+
</li>
|
1019
|
+
</ul>
|
1020
|
+
<p>
|
1021
|
+
Returns:
|
1022
|
+
</p>
|
1023
|
+
<ul>
|
1024
|
+
<li>true : On Success
|
1025
|
+
|
1026
|
+
</li>
|
1027
|
+
<li>false: On Failure
|
1028
|
+
|
1029
|
+
<p>
|
1030
|
+
<a href="Queue.html#M000011">comp_code</a> and <a
|
1031
|
+
href="Queue.html#M000012">reason_code</a> are also updated. reason will
|
1032
|
+
return a text description of the <a
|
1033
|
+
href="Queue.html#M000012">reason_code</a>
|
1034
|
+
</p>
|
1035
|
+
</li>
|
1036
|
+
</ul>
|
1037
|
+
<p>
|
1038
|
+
Throws:
|
1039
|
+
</p>
|
1040
|
+
<ul>
|
1041
|
+
<li><a href="WMQException.html">WMQ::WMQException</a> if <a
|
1042
|
+
href="Queue.html#M000011">comp_code</a> == MQCC_FAILED
|
1043
|
+
|
1044
|
+
</li>
|
1045
|
+
<li>Except if :exception_on_error => false was supplied as a parameter to <a
|
1046
|
+
href="QueueManager.html#M000016">QueueManager.new</a>
|
1047
|
+
|
1048
|
+
</li>
|
1049
|
+
</ul>
|
1050
|
+
<p>
|
1051
|
+
Example:
|
1052
|
+
</p>
|
1053
|
+
<pre>
|
1054
|
+
require 'wmq/wmq_client'
|
1055
|
+
queue_manager = WMQ::QueueManager.new(:q_mgr_name =>'REID',
|
1056
|
+
:connection_name=>'localhost(1414)')
|
1057
|
+
begin
|
1058
|
+
queue_manager.connect
|
1059
|
+
|
1060
|
+
# Create Queue and clear any messages from the queue
|
1061
|
+
in_queue = WMQ::Queue.new(:queue_manager =>queue_manager,
|
1062
|
+
:mode =>:input,
|
1063
|
+
:dynamic_q_name=>'UNIT.TEST',
|
1064
|
+
:q_name =>'SYSTEM.DEFAULT.MODEL.QUEUE',
|
1065
|
+
:fail_if_exists=>false)
|
1066
|
+
begin
|
1067
|
+
in_queue.open
|
1068
|
+
in_queue.each { |message| p message.data }
|
1069
|
+
ensure
|
1070
|
+
# Note: Very important: Must close the queue explicitly
|
1071
|
+
in_queue.close
|
1072
|
+
end
|
1073
|
+
rescue => exc
|
1074
|
+
queue_manager.backout
|
1075
|
+
raise exc
|
1076
|
+
ensure
|
1077
|
+
# Note: Very important: Must disconnect from the queue manager explicitly
|
1078
|
+
queue_manager.disconnect
|
1079
|
+
end
|
1080
|
+
</pre>
|
1081
|
+
</div>
|
1082
|
+
</div>
|
1083
|
+
|
1084
|
+
<div id="method-M000014" class="method-detail">
|
1085
|
+
<a name="M000014"></a>
|
1086
|
+
|
1087
|
+
<div class="method-heading">
|
1088
|
+
<a href="Queue.src/M000014.html" target="Code" class="method-signature"
|
1089
|
+
onclick="popupCode('Queue.src/M000014.html');return false;">
|
1090
|
+
<span class="method-name">open?</span><span class="method-args">()</span>
|
1091
|
+
</a>
|
1092
|
+
</div>
|
1093
|
+
|
1094
|
+
<div class="method-description">
|
1095
|
+
<p>
|
1096
|
+
Returns whether this queue is currently open
|
1097
|
+
</p>
|
1098
|
+
<p>
|
1099
|
+
Returns:
|
1100
|
+
</p>
|
1101
|
+
<ul>
|
1102
|
+
<li>true : The queue is open
|
1103
|
+
|
1104
|
+
</li>
|
1105
|
+
<li>false: The queue is <em>not</em> open
|
1106
|
+
|
1107
|
+
</li>
|
1108
|
+
</ul>
|
1109
|
+
</div>
|
1110
|
+
</div>
|
1111
|
+
|
1112
|
+
<div id="method-M000007" class="method-detail">
|
1113
|
+
<a name="M000007"></a>
|
1114
|
+
|
1115
|
+
<div class="method-heading">
|
1116
|
+
<a href="Queue.src/M000007.html" target="Code" class="method-signature"
|
1117
|
+
onclick="popupCode('Queue.src/M000007.html');return false;">
|
1118
|
+
<span class="method-name">put(...)<br />
|
1119
|
+
</span>
|
1120
|
+
</a>
|
1121
|
+
</div>
|
1122
|
+
|
1123
|
+
<div class="method-description">
|
1124
|
+
<p>
|
1125
|
+
Put a message to the WebSphere MQ queue
|
1126
|
+
</p>
|
1127
|
+
<p>
|
1128
|
+
Parameters:
|
1129
|
+
</p>
|
1130
|
+
<ul>
|
1131
|
+
<li>A Hash consisting of one or more of the named parameters
|
1132
|
+
|
1133
|
+
</li>
|
1134
|
+
<li>Summary of parameters and their WebSphere MQ equivalents
|
1135
|
+
|
1136
|
+
</li>
|
1137
|
+
</ul>
|
1138
|
+
<pre>
|
1139
|
+
queue.put( # WebSphere MQ Equivalents:
|
1140
|
+
:message => my_message, # n/a : Instance of Message
|
1141
|
+
:data => "Hello World", # n/a : Data to send
|
1142
|
+
:sync => false, # MQGMO_SYNCPOINT
|
1143
|
+
:new_id => true, # MQPMO_NEW_MSG_ID & MQPMO_NEW_CORREL_ID
|
1144
|
+
:new_msg_id => true, # MQPMO_NEW_MSG_ID
|
1145
|
+
:new_correl_id => true, # MQPMO_NEW_CORREL_ID
|
1146
|
+
:fail_if_quiescing => true, # MQOO_FAIL_IF_QUIESCING
|
1147
|
+
:options => WMQ::MQPMO_FAIL_IF_QUIESCING # MQPMO_*
|
1148
|
+
)
|
1149
|
+
</pre>
|
1150
|
+
<p>
|
1151
|
+
Mandatory Parameters:
|
1152
|
+
</p>
|
1153
|
+
<ul>
|
1154
|
+
<li>Either :message or :data must be supplied
|
1155
|
+
|
1156
|
+
<ul>
|
1157
|
+
<li>If both are supplied, then :data will be written to the queue. The data in
|
1158
|
+
:message will be ignored
|
1159
|
+
|
1160
|
+
</li>
|
1161
|
+
</ul>
|
1162
|
+
</li>
|
1163
|
+
</ul>
|
1164
|
+
<p>
|
1165
|
+
Optional Parameters:
|
1166
|
+
</p>
|
1167
|
+
<ul>
|
1168
|
+
<li>:data => String
|
1169
|
+
|
1170
|
+
<ul>
|
1171
|
+
<li>Data to be written to the queue. Can be binary or text data
|
1172
|
+
|
1173
|
+
</li>
|
1174
|
+
<li>Takes precendence over the data in :message
|
1175
|
+
|
1176
|
+
</li>
|
1177
|
+
</ul>
|
1178
|
+
</li>
|
1179
|
+
<li>:message => <a href="Message.html">Message</a>
|
1180
|
+
|
1181
|
+
<ul>
|
1182
|
+
<li>An instance of the <a href="Message.html">WMQ::Message</a>
|
1183
|
+
|
1184
|
+
</li>
|
1185
|
+
<li>The <a href="Message.html">Message</a> descriptor, headers and data is
|
1186
|
+
retrieved from :message
|
1187
|
+
|
1188
|
+
<ul>
|
1189
|
+
<li>message.data is ignored if :data is supplied
|
1190
|
+
|
1191
|
+
</li>
|
1192
|
+
</ul>
|
1193
|
+
</li>
|
1194
|
+
</ul>
|
1195
|
+
</li>
|
1196
|
+
<li>:sync => true or false
|
1197
|
+
|
1198
|
+
<ul>
|
1199
|
+
<li>Determines whether the get is performed under synchpoint. I.e. Under the
|
1200
|
+
current unit of work
|
1201
|
+
|
1202
|
+
<pre>
|
1203
|
+
Default: false
|
1204
|
+
</pre>
|
1205
|
+
</li>
|
1206
|
+
</ul>
|
1207
|
+
</li>
|
1208
|
+
<li>:new_id => true or false
|
1209
|
+
|
1210
|
+
<ul>
|
1211
|
+
<li>Generate a new message id and correlation id for this message. :new_msg_id
|
1212
|
+
and :new_correl_id will be ignored if this parameter is true
|
1213
|
+
|
1214
|
+
<pre>
|
1215
|
+
Default: false
|
1216
|
+
</pre>
|
1217
|
+
</li>
|
1218
|
+
</ul>
|
1219
|
+
</li>
|
1220
|
+
<li>:new_msg_id => true or false
|
1221
|
+
|
1222
|
+
<ul>
|
1223
|
+
<li>Generate a new message id for this message
|
1224
|
+
|
1225
|
+
</li>
|
1226
|
+
<li>Note: A blank message id will result in a new message id anyway. However,
|
1227
|
+
for subsequent puts using the same message descriptor, the same message id
|
1228
|
+
will be used.
|
1229
|
+
|
1230
|
+
<pre>
|
1231
|
+
Default: false
|
1232
|
+
</pre>
|
1233
|
+
</li>
|
1234
|
+
</ul>
|
1235
|
+
</li>
|
1236
|
+
<li>:new_correl_id => true or false
|
1237
|
+
|
1238
|
+
<ul>
|
1239
|
+
<li>Generate a new correlation id for this message
|
1240
|
+
|
1241
|
+
<pre>
|
1242
|
+
Default: false
|
1243
|
+
</pre>
|
1244
|
+
</li>
|
1245
|
+
</ul>
|
1246
|
+
</li>
|
1247
|
+
<li>:fail_if_quiescing => true or false
|
1248
|
+
|
1249
|
+
<ul>
|
1250
|
+
<li>Determines whether the <a href="Queue.html#M000007">WMQ::Queue#put</a> call
|
1251
|
+
will fail if the queue manager is in the process of being quiesced.
|
1252
|
+
|
1253
|
+
</li>
|
1254
|
+
<li>Note: This interface differs from other WebSphere MQ interfaces, they do
|
1255
|
+
not default to true.
|
1256
|
+
|
1257
|
+
<pre>
|
1258
|
+
Default: true
|
1259
|
+
Equivalent to: MQGMO_FAIL_IF_QUIESCING
|
1260
|
+
</pre>
|
1261
|
+
</li>
|
1262
|
+
<li>Note: As part of the application design, carefull consideration should be
|
1263
|
+
given as to when to allow a transaction or unit of work to complete or fail
|
1264
|
+
under this condition. As such it is important to include this option where
|
1265
|
+
appropriate so that MQ Administrators can shutdown the queue managers
|
1266
|
+
without having to resort to the ‘immediate’ shutdown option.
|
1267
|
+
|
1268
|
+
</li>
|
1269
|
+
</ul>
|
1270
|
+
</li>
|
1271
|
+
<li>:options => Fixnum (Advanced MQ Use only)
|
1272
|
+
|
1273
|
+
<ul>
|
1274
|
+
<li>Numeric field containing any of the MQ Put message options or’d
|
1275
|
+
together
|
1276
|
+
|
1277
|
+
<ul>
|
1278
|
+
<li>E.g. :options => WMQ::MQPMO_PASS_IDENTITY_CONTEXT |
|
1279
|
+
WMQ::MQPMO_ALTERNATE_USER_AUTHORITY
|
1280
|
+
|
1281
|
+
</li>
|
1282
|
+
</ul>
|
1283
|
+
</li>
|
1284
|
+
<li>Note: If :options is supplied, it is applied first, then the above
|
1285
|
+
parameters are applied afterwards.
|
1286
|
+
|
1287
|
+
</li>
|
1288
|
+
<li>One or more of the following values:
|
1289
|
+
|
1290
|
+
<pre>
|
1291
|
+
WMQ::MQPMO_NO_SYNCPOINT
|
1292
|
+
WMQ::MQPMO_LOGICAL_ORDER
|
1293
|
+
WMQ::MQPMO_NO_CONTEXT
|
1294
|
+
WMQ::MQPMO_DEFAULT_CONTEXT
|
1295
|
+
WMQ::MQPMO_PASS_IDENTITY_CONTEXT
|
1296
|
+
WMQ::MQPMO_PASS_ALL_CONTEXT
|
1297
|
+
WMQ::MQPMO_SET_IDENTITY_CONTEXT
|
1298
|
+
WMQ::MQPMO_SET_ALL_CONTEXT
|
1299
|
+
WMQ::MQPMO_ALTERNATE_USER_AUTHORITY
|
1300
|
+
WMQ::MQPMO_RESOLVE_LOCAL_Q
|
1301
|
+
WMQ::MQPMO_NONE
|
1302
|
+
</pre>
|
1303
|
+
</li>
|
1304
|
+
<li>Please see the WebSphere MQ documentation for more details on the above
|
1305
|
+
options
|
1306
|
+
|
1307
|
+
<pre>
|
1308
|
+
Default: WMQ::MQPMO_NONE
|
1309
|
+
</pre>
|
1310
|
+
</li>
|
1311
|
+
</ul>
|
1312
|
+
</li>
|
1313
|
+
</ul>
|
1314
|
+
<p>
|
1315
|
+
Returns:
|
1316
|
+
</p>
|
1317
|
+
<ul>
|
1318
|
+
<li>true : On Success
|
1319
|
+
|
1320
|
+
</li>
|
1321
|
+
<li>false: On Failure
|
1322
|
+
|
1323
|
+
<p>
|
1324
|
+
<a href="Queue.html#M000011">comp_code</a> and <a
|
1325
|
+
href="Queue.html#M000012">reason_code</a> are also updated. reason will
|
1326
|
+
return a text description of the <a
|
1327
|
+
href="Queue.html#M000012">reason_code</a>
|
1328
|
+
</p>
|
1329
|
+
</li>
|
1330
|
+
</ul>
|
1331
|
+
<p>
|
1332
|
+
Throws:
|
1333
|
+
</p>
|
1334
|
+
<ul>
|
1335
|
+
<li><a href="WMQException.html">WMQ::WMQException</a> if <a
|
1336
|
+
href="Queue.html#M000011">comp_code</a> == MQCC_FAILED
|
1337
|
+
|
1338
|
+
</li>
|
1339
|
+
<li>Except if :exception_on_error => false was supplied as a parameter to <a
|
1340
|
+
href="QueueManager.html#M000016">QueueManager.new</a>
|
1341
|
+
|
1342
|
+
</li>
|
1343
|
+
</ul>
|
1344
|
+
<p>
|
1345
|
+
Example:
|
1346
|
+
</p>
|
1347
|
+
<pre>
|
1348
|
+
require 'wmq/wmq_client'
|
1349
|
+
|
1350
|
+
WMQ::QueueManager.connect(:q_mgr_name=>'REID', :connection_name=>'localhost(1414)') do |qmgr|
|
1351
|
+
qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:output) do |queue|
|
1352
|
+
|
1353
|
+
# First message
|
1354
|
+
queue.put(:data => 'Hello World')
|
1355
|
+
|
1356
|
+
# Set Format of message to string
|
1357
|
+
message = WMQ::Message.new
|
1358
|
+
message.descriptor[:format] = WMQ::MQFMT_STRING
|
1359
|
+
queue.put(:message=>message, :data => 'Hello Again')
|
1360
|
+
|
1361
|
+
# Or, pass the data in the message
|
1362
|
+
message = WMQ::Message.new
|
1363
|
+
message.descriptor[:format] = WMQ::MQFMT_STRING
|
1364
|
+
message.data = 'Hello Again'
|
1365
|
+
queue.put(:message=>message)
|
1366
|
+
end
|
1367
|
+
end
|
1368
|
+
</pre>
|
1369
|
+
</div>
|
1370
|
+
</div>
|
1371
|
+
|
1372
|
+
<div id="method-M000013" class="method-detail">
|
1373
|
+
<a name="M000013"></a>
|
1374
|
+
|
1375
|
+
<div class="method-heading">
|
1376
|
+
<a href="Queue.src/M000013.html" target="Code" class="method-signature"
|
1377
|
+
onclick="popupCode('Queue.src/M000013.html');return false;">
|
1378
|
+
<span class="method-name">reason</span><span class="method-args">()</span>
|
1379
|
+
</a>
|
1380
|
+
</div>
|
1381
|
+
|
1382
|
+
<div class="method-description">
|
1383
|
+
<p>
|
1384
|
+
Returns a textual representation of the <a
|
1385
|
+
href="Queue.html#M000012">reason_code</a> for the last MQ operation on this
|
1386
|
+
queue instance
|
1387
|
+
</p>
|
1388
|
+
<p>
|
1389
|
+
Returns => String
|
1390
|
+
</p>
|
1391
|
+
<ul>
|
1392
|
+
<li>For a complete list of reasons, please see <a href="../WMQ.html">WMQ</a>
|
1393
|
+
Constants or the WebSphere MQ documentation for Reason Codes
|
1394
|
+
|
1395
|
+
</li>
|
1396
|
+
</ul>
|
1397
|
+
<p>
|
1398
|
+
Note
|
1399
|
+
</p>
|
1400
|
+
<ul>
|
1401
|
+
<li>The list of Reason Codes varies depending on the version of WebSphere MQ
|
1402
|
+
and the operating system on which Ruby <a href="../WMQ.html">WMQ</a> was
|
1403
|
+
compiled
|
1404
|
+
|
1405
|
+
</li>
|
1406
|
+
</ul>
|
1407
|
+
</div>
|
1408
|
+
</div>
|
1409
|
+
|
1410
|
+
<div id="method-M000012" class="method-detail">
|
1411
|
+
<a name="M000012"></a>
|
1412
|
+
|
1413
|
+
<div class="method-heading">
|
1414
|
+
<a href="Queue.src/M000012.html" target="Code" class="method-signature"
|
1415
|
+
onclick="popupCode('Queue.src/M000012.html');return false;">
|
1416
|
+
<span class="method-name">reason_code</span><span class="method-args">()</span>
|
1417
|
+
</a>
|
1418
|
+
</div>
|
1419
|
+
|
1420
|
+
<div class="method-description">
|
1421
|
+
<p>
|
1422
|
+
Return the reason code for the last MQ operation on this queue instance
|
1423
|
+
</p>
|
1424
|
+
<p>
|
1425
|
+
Returns => FixNum
|
1426
|
+
</p>
|
1427
|
+
<ul>
|
1428
|
+
<li>For a complete list of reason codes, please see <a
|
1429
|
+
href="../WMQ.html">WMQ</a> Constants or the WebSphere MQ documentation for
|
1430
|
+
Reason Codes
|
1431
|
+
|
1432
|
+
</li>
|
1433
|
+
</ul>
|
1434
|
+
<p>
|
1435
|
+
Note
|
1436
|
+
</p>
|
1437
|
+
<ul>
|
1438
|
+
<li>The list of Reason Codes varies depending on the version of WebSphere MQ
|
1439
|
+
and the operating system on which Ruby <a href="../WMQ.html">WMQ</a> was
|
1440
|
+
compiled
|
1441
|
+
|
1442
|
+
</li>
|
1443
|
+
</ul>
|
1444
|
+
</div>
|
1445
|
+
</div>
|
1446
|
+
|
1447
|
+
|
1448
|
+
</div>
|
1449
|
+
|
1450
|
+
|
1451
|
+
</div>
|
1452
|
+
|
1453
|
+
|
1454
|
+
<div id="validator-badges">
|
1455
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1456
|
+
</div>
|
1457
|
+
|
1458
|
+
</body>
|
1459
|
+
</html>
|