rubywmq 0.3.0-i386-mswin32-mq6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/LICENSE +13 -0
  2. data/README +73 -0
  3. data/doc/classes/WMQ.html +6300 -0
  4. data/doc/classes/WMQ/Message.html +376 -0
  5. data/doc/classes/WMQ/Message.src/M000001.html +77 -0
  6. data/doc/classes/WMQ/Message.src/M000002.html +27 -0
  7. data/doc/classes/WMQ/Queue.html +1459 -0
  8. data/doc/classes/WMQ/Queue.src/M000003.html +205 -0
  9. data/doc/classes/WMQ/Queue.src/M000004.html +107 -0
  10. data/doc/classes/WMQ/Queue.src/M000005.html +198 -0
  11. data/doc/classes/WMQ/Queue.src/M000006.html +66 -0
  12. data/doc/classes/WMQ/Queue.src/M000007.html +203 -0
  13. data/doc/classes/WMQ/Queue.src/M000008.html +265 -0
  14. data/doc/classes/WMQ/Queue.src/M000009.html +120 -0
  15. data/doc/classes/WMQ/Queue.src/M000010.html +28 -0
  16. data/doc/classes/WMQ/Queue.src/M000011.html +30 -0
  17. data/doc/classes/WMQ/Queue.src/M000012.html +31 -0
  18. data/doc/classes/WMQ/Queue.src/M000013.html +31 -0
  19. data/doc/classes/WMQ/Queue.src/M000014.html +31 -0
  20. data/doc/classes/WMQ/QueueManager.html +1529 -0
  21. data/doc/classes/WMQ/QueueManager.src/M000015.html +182 -0
  22. data/doc/classes/WMQ/QueueManager.src/M000016.html +194 -0
  23. data/doc/classes/WMQ/QueueManager.src/M000017.html +92 -0
  24. data/doc/classes/WMQ/QueueManager.src/M000018.html +70 -0
  25. data/doc/classes/WMQ/QueueManager.src/M000019.html +49 -0
  26. data/doc/classes/WMQ/QueueManager.src/M000020.html +49 -0
  27. data/doc/classes/WMQ/QueueManager.src/M000021.html +63 -0
  28. data/doc/classes/WMQ/QueueManager.src/M000022.html +61 -0
  29. data/doc/classes/WMQ/QueueManager.src/M000023.html +65 -0
  30. data/doc/classes/WMQ/QueueManager.src/M000024.html +232 -0
  31. data/doc/classes/WMQ/QueueManager.src/M000025.html +30 -0
  32. data/doc/classes/WMQ/QueueManager.src/M000026.html +31 -0
  33. data/doc/classes/WMQ/QueueManager.src/M000027.html +31 -0
  34. data/doc/classes/WMQ/QueueManager.src/M000028.html +38 -0
  35. data/doc/classes/WMQ/QueueManager.src/M000029.html +33 -0
  36. data/doc/classes/WMQ/QueueManager.src/M000030.html +21 -0
  37. data/doc/classes/WMQ/QueueManager.src/M000031.html +284 -0
  38. data/doc/classes/WMQ/QueueManager.src/M000032.html +24 -0
  39. data/doc/classes/WMQ/QueueManager.src/M000033.html +18 -0
  40. data/doc/classes/WMQ/QueueManager.src/M000034.html +46 -0
  41. data/doc/classes/WMQ/QueueManager.src/M000035.html +27 -0
  42. data/doc/classes/WMQ/WMQException.html +111 -0
  43. data/doc/created.rid +1 -0
  44. data/doc/files/ext/lib/wmq_const_admin_rb.html +128 -0
  45. data/doc/files/ext/lib/wmq_const_rb.html +128 -0
  46. data/doc/files/ext/lib/wmq_temp_rb.html +122 -0
  47. data/doc/files/ext/wmq_c.html +101 -0
  48. data/doc/files/ext/wmq_message_c.html +101 -0
  49. data/doc/files/ext/wmq_queue_c.html +101 -0
  50. data/doc/files/ext/wmq_queue_manager_c.html +101 -0
  51. data/doc/fr_class_index.html +31 -0
  52. data/doc/fr_file_index.html +33 -0
  53. data/doc/fr_method_index.html +61 -0
  54. data/doc/index.html +24 -0
  55. data/doc/rdoc-style.css +208 -0
  56. data/examples/each_a.rb +31 -0
  57. data/examples/each_b.rb +40 -0
  58. data/examples/each_header.rb +37 -0
  59. data/examples/files_to_q.cfg +24 -0
  60. data/examples/files_to_q.rb +46 -0
  61. data/examples/get_a.rb +34 -0
  62. data/examples/get_client.rb +50 -0
  63. data/examples/put1_a.rb +24 -0
  64. data/examples/put1_b.rb +32 -0
  65. data/examples/put1_c.rb +31 -0
  66. data/examples/put_a.rb +34 -0
  67. data/examples/put_b.rb +42 -0
  68. data/examples/put_dlh.rb +40 -0
  69. data/examples/put_dynamic_q.rb +37 -0
  70. data/examples/put_rfh.rb +66 -0
  71. data/examples/put_rfh2_a.rb +42 -0
  72. data/examples/put_rfh2_b.rb +42 -0
  73. data/examples/put_xmit_q.rb +32 -0
  74. data/examples/q_to_files.cfg +17 -0
  75. data/examples/q_to_files.rb +47 -0
  76. data/examples/request.rb +59 -0
  77. data/examples/server.rb +96 -0
  78. data/lib/wmq.rb +25 -0
  79. data/lib/wmq/wmq.so +0 -0
  80. data/lib/wmq/wmq_const.rb +745 -0
  81. data/lib/wmq/wmq_const_admin.rb +555 -0
  82. data/lib/wmq/wmq_temp.rb +197 -0
  83. data/tests/test.rb +299 -0
  84. metadata +131 -0
@@ -0,0 +1,70 @@
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>disconnect (WMQ::QueueManager)</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
+ * Disconnect from this QueueManager instance
15
+ *
16
+ * Returns:
17
+ * * true : On Success
18
+ * * false: On Failure
19
+ *
20
+ * comp_code and reason_code are also updated.
21
+ * reason will return a text description of the reason_code
22
+ *
23
+ * Throws:
24
+ * * WMQ::WMQException if comp_code != MQCC_OK
25
+ * * Except if :exception_on_error =&gt; false was supplied as a parameter
26
+ * to QueueManager.new
27
+ */
28
+ VALUE QueueManager_disconnect(VALUE self)
29
+ {
30
+ PQUEUE_MANAGER pqm;
31
+ Data_Get_Struct(self, QUEUE_MANAGER, pqm);
32
+
33
+ if(pqm-&gt;trace_level) printf (&quot;WMQ::QueueManager#disconnect() Queue Manager Handle:%ld\n&quot;, pqm-&gt;hcon);
34
+
35
+ if (!pqm-&gt;already_connected)
36
+ {
37
+ pqm-&gt;MQDISC(&amp;pqm-&gt;hcon, &amp;pqm-&gt;comp_code, &amp;pqm-&gt;reason_code);
38
+
39
+ if(pqm-&gt;trace_level) printf(&quot;WMQ::QueueManager#disconnect() MQDISC completed with reason:%s\n&quot;, wmq_reason(pqm-&gt;reason_code));
40
+
41
+ if (pqm-&gt;comp_code != MQCC_OK)
42
+ {
43
+ if (pqm-&gt;exception_on_error)
44
+ {
45
+ VALUE name = rb_iv_get(self,&quot;@name&quot;);
46
+ name = StringValue(name);
47
+
48
+ rb_raise(wmq_exception,
49
+ &quot;WMQ::QueueManager#disconnect(). Error disconnecting from Queue Manager:%s, reason:%s&quot;,
50
+ RSTRING(name)-&gt;ptr,
51
+ wmq_reason(pqm-&gt;reason_code));
52
+ }
53
+
54
+ return Qfalse;
55
+ }
56
+ }
57
+ else
58
+ {
59
+ pqm-&gt;comp_code = 0;
60
+ pqm-&gt;reason_code = 0;
61
+
62
+ if(pqm-&gt;trace_level) printf (&quot;WMQ::QueueManager#disconnect() Not calling MQDISC, since already connected on connect\n&quot;);
63
+ }
64
+
65
+ pqm-&gt;hcon = 0;
66
+
67
+ return Qtrue;
68
+ }</pre>
69
+ </body>
70
+ </html>
@@ -0,0 +1,49 @@
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>open_queue (WMQ::QueueManager)</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
+ * call-seq:
15
+ * open_queue(...)
16
+ * access_queue(...)
17
+ *
18
+ * Open the specified queue, then close it once the
19
+ * supplied code block has completed
20
+ *
21
+ * Parameters:
22
+ * * Since the number of parameters can vary dramatically, all parameters are passed by name in a hash
23
+ * * See Queue.open for the complete list of parameters, except that :queue_manager is *not* required
24
+ * since it is supplied automatically by this method
25
+ *
26
+ * Example:
27
+ * require 'wmq/wmq_client'
28
+ *
29
+ * WMQ::QueueManager.connect(:q_mgr_name=&gt;'REID', :connection_name=&gt;'localhost(1414)') do |qmgr|
30
+ * qmgr.open_queue(:q_name=&gt;'TEST.QUEUE', :mode=&gt;:output) do |queue|
31
+ * queue.put(:data =&gt; 'Hello World')
32
+ * end
33
+ * end
34
+ */
35
+ VALUE QueueManager_open_queue(int argc, VALUE *argv, VALUE self)
36
+ {
37
+ VALUE parameters;
38
+ VALUE proc;
39
+
40
+ /* Extract parameters and code block (Proc) */
41
+ rb_scan_args(argc, argv, &quot;1&amp;&quot;, &amp;parameters, &amp;proc);
42
+
43
+ Check_Type(parameters, T_HASH);
44
+ rb_hash_aset(parameters, ID2SYM(ID_queue_manager), self);
45
+
46
+ return rb_iterate(QueueManager_open_queue_each, parameters, QueueManager_open_queue_block, proc);
47
+ }</pre>
48
+ </body>
49
+ </html>
@@ -0,0 +1,49 @@
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>access_queue (WMQ::QueueManager)</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
+ * call-seq:
15
+ * open_queue(...)
16
+ * access_queue(...)
17
+ *
18
+ * Open the specified queue, then close it once the
19
+ * supplied code block has completed
20
+ *
21
+ * Parameters:
22
+ * * Since the number of parameters can vary dramatically, all parameters are passed by name in a hash
23
+ * * See Queue.open for the complete list of parameters, except that :queue_manager is *not* required
24
+ * since it is supplied automatically by this method
25
+ *
26
+ * Example:
27
+ * require 'wmq/wmq_client'
28
+ *
29
+ * WMQ::QueueManager.connect(:q_mgr_name=&gt;'REID', :connection_name=&gt;'localhost(1414)') do |qmgr|
30
+ * qmgr.open_queue(:q_name=&gt;'TEST.QUEUE', :mode=&gt;:output) do |queue|
31
+ * queue.put(:data =&gt; 'Hello World')
32
+ * end
33
+ * end
34
+ */
35
+ VALUE QueueManager_open_queue(int argc, VALUE *argv, VALUE self)
36
+ {
37
+ VALUE parameters;
38
+ VALUE proc;
39
+
40
+ /* Extract parameters and code block (Proc) */
41
+ rb_scan_args(argc, argv, &quot;1&amp;&quot;, &amp;parameters, &amp;proc);
42
+
43
+ Check_Type(parameters, T_HASH);
44
+ rb_hash_aset(parameters, ID2SYM(ID_queue_manager), self);
45
+
46
+ return rb_iterate(QueueManager_open_queue_each, parameters, QueueManager_open_queue_block, proc);
47
+ }</pre>
48
+ </body>
49
+ </html>
@@ -0,0 +1,63 @@
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>begin (WMQ::QueueManager)</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
+ * Advanced WebSphere MQ Use:
15
+ *
16
+ * Begin a unit of work between this QueueManager instance and another
17
+ * resource such as a Database
18
+ *
19
+ * Starts a new unit of work under which put and get can be called with
20
+ * with the parameter :sync =&gt; true
21
+ *
22
+ * Returns:
23
+ * * true : On Success
24
+ * * false: On Failure
25
+ *
26
+ * comp_code and reason_code are also updated.
27
+ * reason will return a text description of the reason_code
28
+ *
29
+ * Throws:
30
+ * * WMQ::WMQException if comp_code != MQCC_OK
31
+ * * Except if :exception_on_error =&gt; false was supplied as a parameter
32
+ * to QueueManager.new
33
+ */
34
+ VALUE QueueManager_begin(VALUE self)
35
+ {
36
+ PQUEUE_MANAGER pqm;
37
+ Data_Get_Struct(self, QUEUE_MANAGER, pqm);
38
+
39
+ if(pqm-&gt;trace_level) printf (&quot;WMQ::QueueManager#begin() Queue Manager Handle:%ld\n&quot;, pqm-&gt;hcon);
40
+
41
+ pqm-&gt;MQBEGIN(pqm-&gt;hcon, 0, &amp;pqm-&gt;comp_code, &amp;pqm-&gt;reason_code);
42
+
43
+ if(pqm-&gt;trace_level) printf(&quot;WMQ::QueueManager#begin() MQBEGIN completed with reason:%s\n&quot;, wmq_reason(pqm-&gt;reason_code));
44
+
45
+ if (pqm-&gt;comp_code != MQCC_OK)
46
+ {
47
+ if (pqm-&gt;exception_on_error)
48
+ {
49
+ VALUE name = rb_iv_get(self,&quot;@name&quot;);
50
+ name = StringValue(name);
51
+
52
+ rb_raise(wmq_exception,
53
+ &quot;WMQ::QueueManager#begin(). Error starting unit of work on Queue Manager:%s, reason:%s&quot;,
54
+ RSTRING(name)-&gt;ptr,
55
+ wmq_reason(pqm-&gt;reason_code));
56
+ }
57
+ return Qfalse;
58
+ }
59
+
60
+ return Qtrue;
61
+ }</pre>
62
+ </body>
63
+ </html>
@@ -0,0 +1,61 @@
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>commit (WMQ::QueueManager)</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
+ * Commit the current unit of work for this QueueManager instance
15
+ *
16
+ * Note:
17
+ * * commit will have no effect if all put and get operations were performed
18
+ * without specifying :sync =&gt; true
19
+ *
20
+ * Returns:
21
+ * * true : On Success
22
+ * * false: On Failure
23
+ *
24
+ * comp_code and reason_code are also updated.
25
+ * reason will return a text description of the reason_code
26
+ *
27
+ * Throws:
28
+ * * WMQ::WMQException if comp_code != MQCC_OK
29
+ * * Except if :exception_on_error =&gt; false was supplied as a parameter
30
+ * to QueueManager.new
31
+ */
32
+ VALUE QueueManager_commit(VALUE self)
33
+ {
34
+ PQUEUE_MANAGER pqm;
35
+ Data_Get_Struct(self, QUEUE_MANAGER, pqm);
36
+
37
+ if(pqm-&gt;trace_level) printf (&quot;WMQ::QueueManager#commit() Queue Manager Handle:%ld\n&quot;, pqm-&gt;hcon);
38
+
39
+ pqm-&gt;MQCMIT(pqm-&gt;hcon, &amp;pqm-&gt;comp_code, &amp;pqm-&gt;reason_code);
40
+
41
+ if(pqm-&gt;trace_level) printf(&quot;WMQ::QueueManager#commit() MQCMIT completed with reason:%s\n&quot;, wmq_reason(pqm-&gt;reason_code));
42
+
43
+ if (pqm-&gt;comp_code != MQCC_OK)
44
+ {
45
+ if (pqm-&gt;exception_on_error)
46
+ {
47
+ VALUE name = rb_iv_get(self,&quot;@name&quot;);
48
+ name = StringValue(name);
49
+
50
+ rb_raise(wmq_exception,
51
+ &quot;WMQ::QueueManager#commit(). Error commiting changes to Queue Manager:%s, reason:%s&quot;,
52
+ RSTRING(name)-&gt;ptr,
53
+ wmq_reason(pqm-&gt;reason_code));
54
+ }
55
+ return Qfalse;
56
+ }
57
+
58
+ return Qtrue;
59
+ }</pre>
60
+ </body>
61
+ </html>
@@ -0,0 +1,65 @@
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>backout (WMQ::QueueManager)</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
+ * Backout the current unit of work for this QueueManager instance
15
+ *
16
+ * Since the last commit or rollback any messages put to a queue
17
+ * under synchpoint will be removed and any messages retrieved
18
+ * under synchpoint from any queues will be returned
19
+ *
20
+ * Note:
21
+ * * backout will have no effect if all put and get operations were performed
22
+ * without specifying :sync =&gt; true
23
+ *
24
+ * Returns:
25
+ * * true : On Success
26
+ * * false: On Failure
27
+ *
28
+ * comp_code and reason_code are also updated.
29
+ * reason will return a text description of the reason_code
30
+ *
31
+ * Throws:
32
+ * * WMQ::WMQException if comp_code != MQCC_OK
33
+ * * Except if :exception_on_error =&gt; false was supplied as a parameter
34
+ * to QueueManager.new
35
+ */
36
+ VALUE QueueManager_backout(VALUE self)
37
+ {
38
+ PQUEUE_MANAGER pqm;
39
+ Data_Get_Struct(self, QUEUE_MANAGER, pqm);
40
+
41
+ if(pqm-&gt;trace_level) printf (&quot;WMQ::QueueManager#backout() Queue Manager Handle:%ld\n&quot;, pqm-&gt;hcon);
42
+
43
+ pqm-&gt;MQBACK(pqm-&gt;hcon, &amp;pqm-&gt;comp_code, &amp;pqm-&gt;reason_code);
44
+
45
+ if(pqm-&gt;trace_level) printf(&quot;WMQ::QueueManager#backout() MQBACK completed with reason:%s\n&quot;, wmq_reason(pqm-&gt;reason_code));
46
+
47
+ if (pqm-&gt;comp_code != MQCC_OK)
48
+ {
49
+ if (pqm-&gt;exception_on_error)
50
+ {
51
+ VALUE name = rb_iv_get(self,&quot;@name&quot;);
52
+ name = StringValue(name);
53
+
54
+ rb_raise(wmq_exception,
55
+ &quot;WMQ::QueueManager#backout(). Error backing out changes to Queue Manager:%s, reason:%s&quot;,
56
+ RSTRING(name)-&gt;ptr,
57
+ wmq_reason(pqm-&gt;reason_code));
58
+ }
59
+ return Qfalse;
60
+ }
61
+
62
+ return Qtrue;
63
+ }</pre>
64
+ </body>
65
+ </html>
@@ -0,0 +1,232 @@
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>put (WMQ::QueueManager)</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
+ * call-seq:
15
+ * put(parameters)
16
+ *
17
+ * Put a message to the queue without having to first open the queue
18
+ * Recommended for reply queues that change frequently
19
+ *
20
+ * * parameters: a Hash consisting of one or more of the following parameters
21
+ *
22
+ * Summary of parameters and their WebSphere MQ equivalents
23
+ * queue.get( # WebSphere MQ Equivalents:
24
+ * :q_name =&gt; 'Queue Name', # MQOD.ObjectName
25
+ * :q_name =&gt; { queue_manager=&gt;'QMGR_name', # MQOD.ObjectQMgrName
26
+ * q_name =&gt;'q_name'}
27
+ * :message =&gt; my_message, # n/a : Instance of Message
28
+ * :data =&gt; &quot;Hello World&quot;, # n/a : Data to send
29
+ * :sync =&gt; false, # MQGMO_SYNCPOINT
30
+ * :new_id =&gt; true, # MQPMO_NEW_MSG_ID &amp; MQPMO_NEW_CORREL_ID
31
+ * :new_msg_id =&gt; true, # MQPMO_NEW_MSG_ID
32
+ * :new_correl_id =&gt; true, # MQPMO_NEW_CORREL_ID
33
+ * :fail_if_quiescing =&gt; true, # MQOO_FAIL_IF_QUIESCING
34
+ * :options =&gt; WMQ::MQPMO_FAIL_IF_QUIESCING # MQPMO_*
35
+ * )
36
+ *
37
+ * Mandatory Parameters
38
+ * * :q_name =&gt; String
39
+ * * Name of the existing WebSphere MQ local queue, model queue or remote queue to open
40
+ * * To open remote queues for which a local remote queue definition is not available
41
+ * pass a Hash as q_name (see q_name =&gt; Hash)
42
+ * OR
43
+ * * :q_name =&gt; Hash
44
+ * * q_name =&gt; String
45
+ * * Name of the existing WebSphere MQ local queue, model queue or remote queue to open
46
+ * * :q_mgr_name =&gt; String
47
+ * * Name of the remote WebSphere MQ queue manager to send the message to.
48
+ * * This allows a message to be written to a queue on a remote queue manager
49
+ * where a remote queue definition is not defined locally
50
+ * * Commonly used to reply to messages from remote systems
51
+ * * If q_mgr_name is the same as the local queue manager name then the message
52
+ * is merely written to the local queue.
53
+ * * Note: q_mgr_name should only be supplied when putting messages to the queue.
54
+ * It is not possible to get messages from a queue on a queue manager other
55
+ * than the currently connected queue manager
56
+ *
57
+ * * Either :message or :data must be supplied
58
+ * * If both are supplied, then :data will be written to the queue. The data in :message
59
+ * will be ignored
60
+ *
61
+ * Optional Parameters
62
+ * * :data =&gt; String
63
+ * * Data to be written to the queue. Can be binary or text data
64
+ *
65
+ * * :message =&gt; Message
66
+ * * An instance of the WMQ::Message
67
+ * * The Message descriptor, headers and data is retrieved from :message
68
+ * * message.data is ignored if :data is supplied
69
+ *
70
+ * * :sync =&gt; true or false
71
+ * * Determines whether the get is performed under synchpoint.
72
+ * I.e. Under the current unit of work
73
+ * Default: false
74
+ *
75
+ * * :new_id =&gt; true or false
76
+ * * Generate a new message id and correlation id for this
77
+ * message. :new_msg_id and :new_correl_id will be ignored
78
+ * if this parameter is true
79
+ * Default: false
80
+ *
81
+ * * :new_msg_id =&gt; true or false
82
+ * * Generate a new message id for this message
83
+ * * Note: A blank message id will result in a new message id anyway.
84
+ * However, for subsequent puts using the same message descriptor, the same
85
+ * message id will be used.
86
+ * Default: false
87
+ *
88
+ * * :new_correl_id =&gt; true or false
89
+ * * Generate a new correlation id for this message
90
+ * Default: false
91
+ *
92
+ * * :fail_if_quiescing =&gt; true or false
93
+ * * Determines whether the WMQ::Queue#put call will fail if the queue manager is
94
+ * in the process of being quiesced.
95
+ * * Note: This interface differs from other WebSphere MQ interfaces,
96
+ * they do not default to true.
97
+ * Default: true
98
+ * Equivalent to: MQGMO_FAIL_IF_QUIESCING
99
+ *
100
+ * * Note: As part of the application design, carefull consideration
101
+ * should be given as to when to allow a transaction or
102
+ * unit of work to complete or fail under this condition.
103
+ * As such it is important to include this option where
104
+ * appropriate so that MQ Administrators can shutdown the
105
+ * queue managers without having to resort to the 'immediate'
106
+ * shutdown option.
107
+ *
108
+ * * :options =&gt; Fixnum (Advanced MQ Use only)
109
+ * * Numeric field containing any of the MQ Put message options or'd together
110
+ * * E.g. :options =&gt; WMQ::MQPMO_PASS_IDENTITY_CONTEXT | WMQ::MQPMO_ALTERNATE_USER_AUTHORITY
111
+ * * Note: If :options is supplied, it is applied first, then the above parameters are
112
+ * applied afterwards.
113
+ * * One or more of the following values:
114
+ * WMQ::MQPMO_NO_SYNCPOINT
115
+ * WMQ::MQPMO_LOGICAL_ORDER
116
+ * WMQ::MQPMO_NO_CONTEXT
117
+ * WMQ::MQPMO_DEFAULT_CONTEXT
118
+ * WMQ::MQPMO_PASS_IDENTITY_CONTEXT
119
+ * WMQ::MQPMO_PASS_ALL_CONTEXT
120
+ * WMQ::MQPMO_SET_IDENTITY_CONTEXT
121
+ * WMQ::MQPMO_SET_ALL_CONTEXT
122
+ * WMQ::MQPMO_ALTERNATE_USER_AUTHORITY
123
+ * WMQ::MQPMO_RESOLVE_LOCAL_Q
124
+ * WMQ::MQPMO_NONE
125
+ * * Please see the WebSphere MQ documentation for more details on the above options
126
+ * Default: WMQ::MQPMO_NONE
127
+ *
128
+ * Returns:
129
+ * * true : On Success
130
+ * * false: On Failure
131
+ *
132
+ * comp_code and reason_code are also updated.
133
+ * reason will return a text description of the reason_code
134
+ *
135
+ * Throws:
136
+ * * WMQ::WMQException if comp_code == MQCC_FAILED
137
+ * * Except if :exception_on_error =&gt; false was supplied as a parameter
138
+ * to QueueManager.new
139
+ */
140
+ VALUE QueueManager_put(VALUE self, VALUE hash)
141
+ {
142
+ MQLONG BufferLength; /* Length of the message in Buffer */
143
+ PMQVOID pBuffer; /* Message data */
144
+ /*-----------------10/22/2006 7:11PM----------------
145
+ * TODO: Need dynamic buffer here!
146
+ * --------------------------------------------------*/
147
+ MQBYTE header_buffer[65535]; /* message buffer for header use */
148
+ MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
149
+ MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */
150
+ MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
151
+ VALUE q_name;
152
+ VALUE str;
153
+ size_t size;
154
+ size_t length;
155
+ VALUE val;
156
+
157
+ PQUEUE_MANAGER pqm;
158
+ Data_Get_Struct(self, QUEUE_MANAGER, pqm);
159
+
160
+ Check_Type(hash, T_HASH);
161
+
162
+ q_name = rb_hash_aref(hash, ID2SYM(ID_q_name));
163
+
164
+ if (NIL_P(q_name))
165
+ {
166
+ rb_raise(rb_eArgError,
167
+ &quot;Mandatory parameter :q_name is missing from WMQ::QueueManager::put1()&quot;);
168
+ }
169
+
170
+ /* --------------------------------------------------
171
+ * If :q_name is a hash, extract :q_name and :q_mgr_name
172
+ * --------------------------------------------------*/
173
+ if(TYPE(q_name) == T_HASH)
174
+ {
175
+ WMQ_HASH2MQCHARS(q_name, q_mgr_name, od.ObjectQMgrName)
176
+
177
+ q_name = rb_hash_aref(val, ID2SYM(ID_q_name));
178
+ if (NIL_P(q_name))
179
+ {
180
+ rb_raise(rb_eArgError,
181
+ &quot;Mandatory parameter :q_name missing from :q_name hash passed to WMQ::QueueManager#put&quot;);
182
+ }
183
+ }
184
+
185
+ WMQ_STR2MQCHARS(q_name,od.ObjectName)
186
+
187
+ Queue_extract_put_message_options(hash, &amp;pmo);
188
+ Message_build(&amp;pqm-&gt;p_buffer, &amp;pqm-&gt;buffer_size, pqm-&gt;trace_level,
189
+ hash, &amp;pBuffer, &amp;BufferLength, &amp;md);
190
+
191
+ if(pqm-&gt;trace_level) printf(&quot;WMQ::QueueManager#put Queue Manager Handle:%ld\n&quot;, pqm-&gt;hcon);
192
+
193
+ pqm-&gt;MQPUT1(
194
+ pqm-&gt;hcon, /* connection handle */
195
+ &amp;od, /* object descriptor */
196
+ &amp;md, /* message descriptor */
197
+ &amp;pmo, /* put message options */
198
+ BufferLength, /* message length */
199
+ pBuffer, /* message buffer */
200
+ &amp;pqm-&gt;comp_code, /* completion code */
201
+ &amp;pqm-&gt;reason_code); /* reason code */
202
+
203
+ if(pqm-&gt;trace_level) printf(&quot;WMQ::QueueManager#put MQPUT1 ended with reason:%s\n&quot;, wmq_reason(pqm-&gt;reason_code));
204
+
205
+ if (pqm-&gt;reason_code != MQRC_NONE)
206
+ {
207
+ if (pqm-&gt;exception_on_error)
208
+ {
209
+ VALUE qmgr_name = QueueManager_name(self);
210
+
211
+ rb_raise(wmq_exception,
212
+ &quot;WMQ::QueueManager.put(). Error writing a message to Queue:%s on Queue Manager:%s reason:%s&quot;,
213
+ RSTRING(q_name)-&gt;ptr,
214
+ RSTRING(qmgr_name)-&gt;ptr,
215
+ wmq_reason(pqm-&gt;reason_code));
216
+ }
217
+ return Qfalse;
218
+ }
219
+ else
220
+ {
221
+ VALUE message = rb_hash_aref(hash, ID2SYM(ID_message));
222
+ if(!NIL_P(message))
223
+ {
224
+ VALUE descriptor = rb_funcall(message, ID_descriptor, 0);
225
+ Message_from_mqmd(descriptor, &amp;md); /* This could be optimized to output only fields */
226
+ }
227
+ }
228
+
229
+ return Qtrue;
230
+ }</pre>
231
+ </body>
232
+ </html>