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,30 @@
|
|
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>comp_code (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
|
+
* Return the completion code for the last MQ operation
|
15
|
+
*
|
16
|
+
* Returns => FixNum
|
17
|
+
* * WMQ::MQCC_OK 0
|
18
|
+
* * WMQ::MQCC_WARNING 1
|
19
|
+
* * WMQ::MQCC_FAILED 2
|
20
|
+
* * WMQ::MQCC_UNKNOWN -1
|
21
|
+
*
|
22
|
+
*/
|
23
|
+
VALUE QueueManager_comp_code(VALUE self)
|
24
|
+
{
|
25
|
+
PQUEUE_MANAGER pqm;
|
26
|
+
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
27
|
+
return LONG2NUM(pqm->comp_code);
|
28
|
+
}</pre>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
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>reason_code (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
|
+
* Return the reason code for the last MQ operation
|
15
|
+
*
|
16
|
+
* Returns => FixNum
|
17
|
+
* * For a complete list of reason codes, please see WMQ Constants or
|
18
|
+
* the WebSphere MQ documentation for Reason Codes
|
19
|
+
*
|
20
|
+
* Note
|
21
|
+
* * The list of Reason Codes varies depending on the version of WebSphere MQ
|
22
|
+
* and the operating system on which Ruby WMQ was compiled
|
23
|
+
*/
|
24
|
+
VALUE QueueManager_reason_code(VALUE self)
|
25
|
+
{
|
26
|
+
PQUEUE_MANAGER pqm;
|
27
|
+
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
28
|
+
return LONG2NUM(pqm->reason_code);
|
29
|
+
}</pre>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
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>reason (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
|
+
* Returns a textual representation of the reason_code for the last MQ operation
|
15
|
+
*
|
16
|
+
* Returns => String
|
17
|
+
* * For a complete list of reasons, please see WMQ Constants or
|
18
|
+
* the WebSphere MQ documentation for Reason Codes
|
19
|
+
*
|
20
|
+
* Note
|
21
|
+
* * The list of Reason Codes varies depending on the version of WebSphere MQ
|
22
|
+
* and the operating system on which Ruby WMQ was compiled
|
23
|
+
*/
|
24
|
+
VALUE QueueManager_reason(VALUE self)
|
25
|
+
{
|
26
|
+
PQUEUE_MANAGER pqm;
|
27
|
+
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
28
|
+
return rb_str_new2(wmq_reason(pqm->reason_code));
|
29
|
+
}</pre>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,38 @@
|
|
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>exception_on_error (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
|
+
* Returns whether this QueueManager instance is set
|
15
|
+
* to throw a WMQ::WMQException whenever an MQ operation fails
|
16
|
+
*
|
17
|
+
* Returns:
|
18
|
+
* * true : This QueueManager instance will throw a WMQ::WMQException whenever
|
19
|
+
* an MQ operation fails. I.e. if comp_code != WMQ::OK.
|
20
|
+
* * false: WMQ::WMQException will not be thrown
|
21
|
+
*
|
22
|
+
* Note:
|
23
|
+
* * RuntimeError and ArgumentError exceptions are always thrown regardless of the
|
24
|
+
* value of exception_on_error
|
25
|
+
*/
|
26
|
+
VALUE QueueManager_exception_on_error(VALUE self)
|
27
|
+
{
|
28
|
+
PQUEUE_MANAGER pqm;
|
29
|
+
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
30
|
+
if (pqm->exception_on_error)
|
31
|
+
{
|
32
|
+
return Qtrue;
|
33
|
+
}
|
34
|
+
|
35
|
+
return Qfalse;
|
36
|
+
}</pre>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
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>connected? (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
|
+
* Returns whether this QueueManager instance is currently
|
15
|
+
* connected to a WebSphere MQ queue manager
|
16
|
+
*
|
17
|
+
* Returns:
|
18
|
+
* * true : This QueueManager instance is connected to a local or remote queue manager
|
19
|
+
* * false: This QueueManager instance is not currently connected to a local or
|
20
|
+
* remote queue manager
|
21
|
+
*/
|
22
|
+
VALUE QueueManager_connected_q(VALUE self)
|
23
|
+
{
|
24
|
+
PQUEUE_MANAGER pqm;
|
25
|
+
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
26
|
+
if (pqm->hcon)
|
27
|
+
{
|
28
|
+
return Qtrue;
|
29
|
+
}
|
30
|
+
return Qfalse;
|
31
|
+
}</pre>
|
32
|
+
</body>
|
33
|
+
</html>
|
@@ -0,0 +1,21 @@
|
|
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>name (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
|
+
* Returns the QueueManager name => String
|
15
|
+
*/
|
16
|
+
VALUE QueueManager_name(VALUE self)
|
17
|
+
{
|
18
|
+
return rb_iv_get(self,"@name");
|
19
|
+
}</pre>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1,284 @@
|
|
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>execute (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
|
+
* execute(...)
|
16
|
+
*
|
17
|
+
* Execute an Administration command against the local queue manager
|
18
|
+
*
|
19
|
+
* Parameters:
|
20
|
+
* * Since the number of parameters can vary dramatically, all parameters are passed by name in a hash
|
21
|
+
* * The entire MQ Administration interface has been implemented.
|
22
|
+
* Rather than re-documentation the hundreds of options, a standard
|
23
|
+
* convention has been used to map the MQ constants to Symbols in Ruby.
|
24
|
+
*
|
25
|
+
* For all MQ Admin commands, just drop the MQAI_ off the front and
|
26
|
+
* convert the command name to lower case.
|
27
|
+
* * E.g. MQAI_INQUIRE_Q becomes inquire_q
|
28
|
+
*
|
29
|
+
* For the hundreds of parameters, a similiar technique is followed.
|
30
|
+
* Remove the prefixes: MQCA_, MQIA_, etc.. and convert to lowercase
|
31
|
+
* * E.g. MQCA_Q_NAME becomes :q_name
|
32
|
+
*
|
33
|
+
* Example
|
34
|
+
* WMQ::QueueManager.connect do |qmgr|
|
35
|
+
* result = qmgr.execute(
|
36
|
+
* :command => :inquire_q,
|
37
|
+
* :q_name => 'MY.LOCAL.QUEUE',
|
38
|
+
* :q_type => WMQ::MQQT_LOCAL,
|
39
|
+
* :current_q_depth => nil
|
40
|
+
* )
|
41
|
+
* # OR, we can replace the method name execute with the MQAI command:
|
42
|
+
* result = qmgr.inquire_q(
|
43
|
+
* :q_name => 'MY.LOCAL.QUEUE',
|
44
|
+
* :q_type => WMQ::MQQT_LOCAL,
|
45
|
+
* :current_q_depth => nil
|
46
|
+
* )
|
47
|
+
*
|
48
|
+
* Complete Example:
|
49
|
+
* require 'wmq/wmq'
|
50
|
+
* require 'wmq/wmq_const_admin'
|
51
|
+
* WMQ::QueueManager.connect(:q_mgr_name=>'REID', :connection_name=>'localhost(1414)') do |qmgr|
|
52
|
+
* qmgr.reset_q_stats(:q_name=>'*').each {|item| p item }
|
53
|
+
* end
|
54
|
+
*
|
55
|
+
* Some one line examples
|
56
|
+
* qmgr.inquire_q(:q_name=>'TEST*').each {|item| p item }
|
57
|
+
*
|
58
|
+
* qmgr.inquire_q(:q_name=>'TEST*', :q_type=>WMQ::MQQT_LOCAL, :current_q_depth=>nil).each {|item| p item }
|
59
|
+
*
|
60
|
+
* qmgr.inquire_process(:process_name=>'*').each {|item| p item }
|
61
|
+
*
|
62
|
+
* qmgr.ping_q_mgr.each {|item| p item }
|
63
|
+
*
|
64
|
+
* qmgr.refresh_security.each {|item| p item }
|
65
|
+
*
|
66
|
+
* qmgr.inquire_q_status(:q_name=>'TEST*', :q_status_type=>:q_status, :q_status_attrs=>:process_id).each {|item| p item }
|
67
|
+
*
|
68
|
+
* qmgr.start_channel_listener.each {|item| p item }
|
69
|
+
*
|
70
|
+
* qmgr.inquire_channel_status(:channel_name=>'*').each {|item| p item }
|
71
|
+
*/
|
72
|
+
VALUE QueueManager_execute(VALUE self, VALUE hash)
|
73
|
+
{
|
74
|
+
#ifdef MQHB_UNUSABLE_HBAG
|
75
|
+
VALUE val, str;
|
76
|
+
PQUEUE_MANAGER pqm;
|
77
|
+
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
78
|
+
|
79
|
+
Check_Type(hash, T_HASH);
|
80
|
+
|
81
|
+
if (pqm->admin_bag == MQHB_UNUSABLE_HBAG) /* Lazy create admin bag */
|
82
|
+
{
|
83
|
+
pqm->mqCreateBag(MQCBO_ADMIN_BAG, &pqm->admin_bag, &pqm->comp_code, &pqm->reason_code);
|
84
|
+
CHECK_COMPLETION_CODE("Creating the admin bag")
|
85
|
+
}
|
86
|
+
else
|
87
|
+
{
|
88
|
+
pqm->mqClearBag(pqm->admin_bag, &pqm->comp_code, &pqm->reason_code);
|
89
|
+
CHECK_COMPLETION_CODE("Clearing the admin bag")
|
90
|
+
}
|
91
|
+
|
92
|
+
if (pqm->reply_bag == MQHB_UNUSABLE_HBAG) /* Lazy create reply bag */
|
93
|
+
{
|
94
|
+
pqm->mqCreateBag(MQCBO_ADMIN_BAG, &pqm->reply_bag, &pqm->comp_code, &pqm->reason_code);
|
95
|
+
CHECK_COMPLETION_CODE("Creating the reply bag")
|
96
|
+
}
|
97
|
+
else
|
98
|
+
{
|
99
|
+
pqm->mqClearBag(pqm->reply_bag, &pqm->comp_code, &pqm->reason_code);
|
100
|
+
CHECK_COMPLETION_CODE("Clearing the reply bag")
|
101
|
+
}
|
102
|
+
|
103
|
+
val = rb_hash_aref(hash, ID2SYM(ID_command)); /* :command */
|
104
|
+
if (NIL_P(val))
|
105
|
+
{
|
106
|
+
rb_raise(rb_eArgError, "WMQ::QueueManager#execute Mandatory parameter :command missing");
|
107
|
+
}
|
108
|
+
#if RUBY_VERSION_CODE > 183
|
109
|
+
rb_hash_foreach(hash, QueueManager_execute_each, (VALUE)pqm);
|
110
|
+
#else
|
111
|
+
rb_iterate (rb_each, hash, QueueManager_execute_each, (VALUE)pqm);
|
112
|
+
#endif
|
113
|
+
if(pqm->trace_level) printf ("WMQ::QueueManager#execute() Queue Manager Handle:%ld\n", pqm->hcon);
|
114
|
+
|
115
|
+
pqm->mqExecute(
|
116
|
+
pqm->hcon, /* MQ connection handle */
|
117
|
+
wmq_command_lookup(rb_to_id(val)), /* Command to be executed */
|
118
|
+
MQHB_NONE, /* No options bag */
|
119
|
+
pqm->admin_bag, /* Handle to bag containing commands */
|
120
|
+
pqm->reply_bag, /* Handle to bag to receive the response*/
|
121
|
+
MQHO_NONE, /* Put msg on SYSTEM.ADMIN.COMMAND.QUEUE*/
|
122
|
+
MQHO_NONE, /* Create a dynamic q for the response */
|
123
|
+
&pqm->comp_code, /* Completion code from the mqexecute */
|
124
|
+
&pqm->reason_code); /* Reason code from mqexecute call */
|
125
|
+
|
126
|
+
if(pqm->trace_level) printf("WMQ::QueueManager#execute() completed with reason:%s\n", wmq_reason(pqm->reason_code));
|
127
|
+
|
128
|
+
if (pqm->comp_code == MQCC_OK)
|
129
|
+
{
|
130
|
+
MQLONG numberOfBags; /* number of bags in response bag */
|
131
|
+
MQHBAG qAttrsBag; /* bag containing q attributes */
|
132
|
+
VALUE array;
|
133
|
+
MQLONG size;
|
134
|
+
MQLONG length;
|
135
|
+
MQCHAR inquiry_buffer[WMQ_EXEC_STRING_INQ_BUFFER_SIZE];
|
136
|
+
PMQCHAR pChar;
|
137
|
+
|
138
|
+
MQLONG qDepth; /* depth of queue */
|
139
|
+
MQLONG item_type;
|
140
|
+
MQLONG selector;
|
141
|
+
MQLONG number_of_items;
|
142
|
+
int bag_index, items, k;
|
143
|
+
|
144
|
+
pqm->mqCountItems(pqm->reply_bag, MQHA_BAG_HANDLE, &numberOfBags, &pqm->comp_code, &pqm->reason_code);
|
145
|
+
CHECK_COMPLETION_CODE("Counting number of bags returned from the command server")
|
146
|
+
|
147
|
+
if(pqm->trace_level > 1) printf("WMQ::QueueManager#execute() %ld bags returned\n", numberOfBags);
|
148
|
+
array = rb_ary_new2(numberOfBags);
|
149
|
+
|
150
|
+
for ( bag_index=0; bag_index<numberOfBags; bag_index++) /* For each bag, extract the queue depth */
|
151
|
+
{
|
152
|
+
hash = rb_hash_new();
|
153
|
+
|
154
|
+
pqm->mqInquireBag(pqm->reply_bag, MQHA_BAG_HANDLE, bag_index, &qAttrsBag, &pqm->comp_code, &pqm->reason_code);
|
155
|
+
CHECK_COMPLETION_CODE("Inquiring for the attribute bag handle")
|
156
|
+
|
157
|
+
pqm->mqCountItems(qAttrsBag, MQSEL_ALL_SELECTORS, &number_of_items, &pqm->comp_code, &pqm->reason_code);
|
158
|
+
CHECK_COMPLETION_CODE("Counting number of items in this bag")
|
159
|
+
|
160
|
+
if(pqm->trace_level > 1) printf("WMQ::QueueManager#execute() Bag %ld contains %ld items\n", bag_index, number_of_items);
|
161
|
+
|
162
|
+
for (items=0; items<number_of_items; items++) /* For each item, extract it's value */
|
163
|
+
{
|
164
|
+
pqm->mqInquireItemInfo(
|
165
|
+
qAttrsBag, /* I: Bag handle */
|
166
|
+
MQSEL_ANY_SELECTOR, /* I: Item selector */
|
167
|
+
items, /* I: Item index */
|
168
|
+
&selector, /* O: Selector of item */
|
169
|
+
&item_type, /* O: Data type of item */
|
170
|
+
&pqm->comp_code,
|
171
|
+
&pqm->reason_code);
|
172
|
+
CHECK_COMPLETION_CODE("Inquiring Item details")
|
173
|
+
|
174
|
+
if (selector > 0) /* Skip system selectors */
|
175
|
+
{
|
176
|
+
switch (item_type)
|
177
|
+
{
|
178
|
+
case MQIT_INTEGER:
|
179
|
+
pqm->mqInquireInteger(qAttrsBag, MQSEL_ALL_SELECTORS, items, &qDepth, &pqm->comp_code, &pqm->reason_code);
|
180
|
+
CHECK_COMPLETION_CODE("Inquiring Integer item")
|
181
|
+
|
182
|
+
if(pqm->trace_level > 1)
|
183
|
+
printf("WMQ::QueueManager#execute() Item %ld: Integer:%ld, selector:%ld\n", items, qDepth, selector);
|
184
|
+
|
185
|
+
rb_hash_aset(hash, ID2SYM(wmq_selector_id(selector)), LONG2NUM(qDepth));
|
186
|
+
break;
|
187
|
+
|
188
|
+
case MQIT_STRING:
|
189
|
+
pqm->mqInquireString(qAttrsBag, MQSEL_ALL_SELECTORS, items, WMQ_EXEC_STRING_INQ_BUFFER_SIZE-1, inquiry_buffer,
|
190
|
+
&size, NULL, &pqm->comp_code, &pqm->reason_code);
|
191
|
+
if(pqm->trace_level > 2)
|
192
|
+
printf("WMQ::QueueManager#execute() mqInquireString buffer size: %ld, string size:%ld\n",
|
193
|
+
WMQ_EXEC_STRING_INQ_BUFFER_SIZE,size);
|
194
|
+
CHECK_COMPLETION_CODE("Inquiring String item")
|
195
|
+
|
196
|
+
length = 0;
|
197
|
+
pChar = inquiry_buffer + size-1;
|
198
|
+
for (k = size; k > 0; k--)
|
199
|
+
{
|
200
|
+
if (*pChar != ' ' && *pChar != 0)
|
201
|
+
{
|
202
|
+
length = k;
|
203
|
+
break;
|
204
|
+
}
|
205
|
+
pChar--;
|
206
|
+
}
|
207
|
+
rb_hash_aset(hash, ID2SYM(wmq_selector_id(selector)), rb_str_new(inquiry_buffer, length));
|
208
|
+
|
209
|
+
if(pqm->trace_level > 1)
|
210
|
+
{
|
211
|
+
inquiry_buffer[length] = '\0';
|
212
|
+
printf("WMQ::QueueManager#execute() Item %ld: String:'%s', selector:%ld\n",
|
213
|
+
items, inquiry_buffer, selector);
|
214
|
+
}
|
215
|
+
break;
|
216
|
+
|
217
|
+
case MQIT_BAG:
|
218
|
+
printf("Ignoring Bag at this level\n");
|
219
|
+
break;
|
220
|
+
|
221
|
+
default:
|
222
|
+
printf("Ignoring Unknown type:%ld\n", item_type);
|
223
|
+
break;
|
224
|
+
}
|
225
|
+
}
|
226
|
+
}
|
227
|
+
rb_ary_push(array, hash);
|
228
|
+
}
|
229
|
+
return array;
|
230
|
+
}
|
231
|
+
else
|
232
|
+
{
|
233
|
+
VALUE name = rb_iv_get(self,"@name");
|
234
|
+
name = StringValue(name);
|
235
|
+
|
236
|
+
if (pqm->reason_code == MQRCCF_COMMAND_FAILED)
|
237
|
+
{
|
238
|
+
/* Find out why admin command failed */
|
239
|
+
MQLONG result_comp_code, result_reason_code;
|
240
|
+
MQHBAG result_bag;
|
241
|
+
|
242
|
+
pqm->mqInquireBag(pqm->reply_bag, MQHA_BAG_HANDLE, 0, &result_bag, &pqm->comp_code, &pqm->reason_code);
|
243
|
+
CHECK_COMPLETION_CODE("Getting the result bag handle")
|
244
|
+
|
245
|
+
pqm->mqInquireInteger(result_bag, MQIASY_COMP_CODE, MQIND_NONE, &result_comp_code, &pqm->comp_code, &pqm->reason_code);
|
246
|
+
CHECK_COMPLETION_CODE("Getting the completion code from the result bag")
|
247
|
+
|
248
|
+
pqm->mqInquireInteger(result_bag, MQIASY_REASON, MQIND_NONE, &result_reason_code, &pqm->comp_code, &pqm->reason_code);
|
249
|
+
CHECK_COMPLETION_CODE("Getting the reason code from the result bag")
|
250
|
+
|
251
|
+
pqm->comp_code = result_comp_code;
|
252
|
+
pqm->reason_code = result_reason_code;
|
253
|
+
|
254
|
+
if(pqm->trace_level)
|
255
|
+
printf("WMQ::QueueManager#execute() Error returned by command server:%s\n", wmq_reason(pqm->reason_code));
|
256
|
+
}
|
257
|
+
|
258
|
+
if (pqm->exception_on_error)
|
259
|
+
{
|
260
|
+
if (pqm->reason_code == MQRC_CMD_SERVER_NOT_AVAILABLE)
|
261
|
+
{
|
262
|
+
rb_raise(wmq_exception,
|
263
|
+
"WMQ::QueueManager#execute(). Please start the WebSphere MQ Command Server : 'strmqcsv %s', reason:%s",
|
264
|
+
RSTRING(name)->ptr,
|
265
|
+
wmq_reason(pqm->reason_code));
|
266
|
+
}
|
267
|
+
else
|
268
|
+
{
|
269
|
+
rb_raise(wmq_exception,
|
270
|
+
"WMQ::QueueManager#execute(). Error executing admin command on Queue Manager:%s, reason:%s",
|
271
|
+
RSTRING(name)->ptr,
|
272
|
+
wmq_reason(pqm->reason_code));
|
273
|
+
}
|
274
|
+
}
|
275
|
+
return Qfalse;
|
276
|
+
}
|
277
|
+
return Qnil;
|
278
|
+
#else
|
279
|
+
rb_notimplement();
|
280
|
+
return Qfalse;
|
281
|
+
#endif
|
282
|
+
}</pre>
|
283
|
+
</body>
|
284
|
+
</html>
|