rubywmq 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -6
- data/examples/each_a.rb +1 -0
- data/examples/each_b.rb +1 -0
- data/examples/each_header.rb +1 -0
- data/examples/files_to_q.cfg +4 -4
- data/examples/files_to_q.rb +2 -2
- data/examples/get_a.rb +1 -0
- data/examples/get_client.rb +1 -0
- data/examples/put1_a.rb +1 -0
- data/examples/put1_b.rb +1 -0
- data/examples/put1_c.rb +1 -0
- data/examples/put_a.rb +1 -0
- data/examples/put_b.rb +1 -0
- data/examples/put_dlh.rb +1 -0
- data/examples/put_dynamic_q.rb +1 -0
- data/examples/put_group_a.rb +51 -0
- data/examples/put_group_b.rb +53 -0
- data/examples/put_rfh.rb +1 -0
- data/examples/put_rfh2_a.rb +1 -0
- data/examples/put_rfh2_b.rb +1 -0
- data/examples/put_xmit_q.rb +1 -0
- data/examples/q_to_files.rb +48 -0
- data/examples/request.rb +1 -0
- data/examples/server.rb +1 -0
- data/ext/build.sh +6 -5
- data/ext/extconf.rb +1 -1
- data/ext/generate/generate_reason.rb +15 -9
- data/ext/generate/generate_structs.rb +0 -2
- data/ext/generate/wmq_structs.erb +2 -2
- data/ext/wmq.c +1 -1
- data/ext/wmq.h +27 -1
- data/ext/wmq_message.c +8 -12
- data/ext/wmq_mq_load.c +4 -0
- data/ext/wmq_queue.c +22 -21
- data/ext/wmq_queue_manager.c +17 -28
- data/tests/test.rb +1 -0
- metadata +59 -49
data/README
CHANGED
@@ -12,12 +12,12 @@
|
|
12
12
|
Building Ruby WMQ on UNIX/Linux
|
13
13
|
-------------------------------
|
14
14
|
The following is required to build from source code
|
15
|
-
|
16
|
-
|
15
|
+
* A 'C' compiler
|
16
|
+
* The WebSphere MQ Software development toolkit
|
17
17
|
|
18
18
|
Extracting the source code package:
|
19
|
-
|
20
|
-
|
19
|
+
* unzip package.zip
|
20
|
+
* tar -xvf package.tar
|
21
21
|
|
22
22
|
cd ext/wmq
|
23
23
|
Edit the file build.sh and edit the location of WebSphere MQ (if not in /opt/mqm)
|
@@ -31,8 +31,8 @@
|
|
31
31
|
Building Ruby WMQ on Windows
|
32
32
|
----------------------------
|
33
33
|
The following is required to build from source code
|
34
|
-
|
35
|
-
|
34
|
+
* The Visual C++ 6.0 compiler
|
35
|
+
* The WebSphere MQ Software development toolkit
|
36
36
|
|
37
37
|
cd ext\wmq
|
38
38
|
Edit the file build.bat and edit the location of WebSphere MQ
|
data/examples/each_a.rb
CHANGED
data/examples/each_b.rb
CHANGED
data/examples/each_header.rb
CHANGED
data/examples/files_to_q.cfg
CHANGED
@@ -2,12 +2,12 @@ dev:
|
|
2
2
|
qmgr_options:
|
3
3
|
:q_mgr_name: REID
|
4
4
|
output_queue:
|
5
|
-
:q_name: TEST.
|
5
|
+
:q_name: TEST.QUEUE
|
6
6
|
put_options:
|
7
7
|
:new_msg_id: true
|
8
8
|
descriptor:
|
9
9
|
:format: MQSTR
|
10
|
-
source_directory:
|
10
|
+
source_directory: messages
|
11
11
|
|
12
12
|
test:
|
13
13
|
qmgr_options:
|
@@ -15,10 +15,10 @@ test:
|
|
15
15
|
:channel_name: SYSTEM.DEF.SVRCONN
|
16
16
|
:connection_name: remotehost(1414)
|
17
17
|
output_queue:
|
18
|
-
:q_name: TEST.
|
18
|
+
:q_name: TEST.QUEUE
|
19
19
|
put_options:
|
20
20
|
:new_msg_id: true
|
21
21
|
descriptor:
|
22
22
|
:format: MQSTR
|
23
|
-
source_directory:
|
23
|
+
source_directory: messages
|
24
24
|
|
data/examples/files_to_q.rb
CHANGED
@@ -15,16 +15,16 @@
|
|
15
15
|
################################################################################
|
16
16
|
|
17
17
|
#
|
18
|
-
#
|
18
|
+
# Example : files_to_q : Place all files in a directory to a queue
|
19
19
|
# Each file is written as a separate message
|
20
20
|
#
|
21
|
+
require 'rubygems'
|
21
22
|
require 'find'
|
22
23
|
require 'yaml'
|
23
24
|
require 'wmq/wmq'
|
24
25
|
|
25
26
|
# Call program passing environment name as first parameter
|
26
27
|
# The environment corresponds to an entry in the config file
|
27
|
-
# Defaults to dev
|
28
28
|
env = ARGV[0] || raise("Command line argument 'environment' is required")
|
29
29
|
config = YAML::load_file('files_to_q.cfg')[env]
|
30
30
|
|
data/examples/get_a.rb
CHANGED
data/examples/get_client.rb
CHANGED
data/examples/put1_a.rb
CHANGED
data/examples/put1_b.rb
CHANGED
data/examples/put1_c.rb
CHANGED
data/examples/put_a.rb
CHANGED
data/examples/put_b.rb
CHANGED
data/examples/put_dlh.rb
CHANGED
data/examples/put_dynamic_q.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
################################################################################
|
16
|
+
|
17
|
+
#
|
18
|
+
# Sample : put() : Put multiple Messages to a queue under the same group Id
|
19
|
+
# Open the queue so that multiple puts can be performed
|
20
|
+
# Ensure that all messages have the same group id
|
21
|
+
# Allow MQ to create the unique group id and let it automatically
|
22
|
+
# assign message sequence numbers for each message in the group
|
23
|
+
#
|
24
|
+
require 'rubygems'
|
25
|
+
require 'wmq/wmq'
|
26
|
+
|
27
|
+
# Put 5 messages in a single group onto the queue
|
28
|
+
total = 5
|
29
|
+
|
30
|
+
WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
|
31
|
+
qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:output) do |queue|
|
32
|
+
message = WMQ::Message.new
|
33
|
+
total.times do |count|
|
34
|
+
message.data = "Hello:#{count}"
|
35
|
+
|
36
|
+
# Set the message flag to indicate message is in a group
|
37
|
+
# On the last message, set the last message flag
|
38
|
+
message.descriptor[:msg_flags] = (count < total-1) ? WMQ::MQMF_MSG_IN_GROUP : WMQ::MQMF_LAST_MSG_IN_GROUP
|
39
|
+
|
40
|
+
# new_id => true causes subsequent messages to have unique message and
|
41
|
+
# correlation id's. Otherwise all messages will have the same message and
|
42
|
+
# correlation id's since the same message object is being
|
43
|
+
# re-used for all put calls.
|
44
|
+
#
|
45
|
+
# By setting the put :options => WMQ::MQPMO_LOGICAL_ORDER then MQ will supply a unique Group Id
|
46
|
+
# and MQ will automatically set the message sequence number for us.
|
47
|
+
queue.put(:message => message, :new_id => true, :options => WMQ::MQPMO_LOGICAL_ORDER)
|
48
|
+
p message.descriptor
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
################################################################################
|
16
|
+
|
17
|
+
#
|
18
|
+
# Sample : put() : Put multiple Messages to a queue under the same group Id
|
19
|
+
# Open the queue so that multiple puts can be performed
|
20
|
+
# Ensure that all messages have the same group id
|
21
|
+
# Supply our own user-defined group Id.
|
22
|
+
# We also have to supply the message sequence number which starts at 1
|
23
|
+
#
|
24
|
+
require 'rubygems'
|
25
|
+
require 'wmq/wmq'
|
26
|
+
|
27
|
+
# Put 5 messages in a single group onto the queue
|
28
|
+
total = 5
|
29
|
+
|
30
|
+
WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
|
31
|
+
qmgr.open_queue(:q_name=>'TEST.QUEUE', :mode=>:output) do |queue|
|
32
|
+
message = WMQ::Message.new
|
33
|
+
# Supply a unique Group Id, truncated to the MQ maximum for Group Id.
|
34
|
+
message.descriptor[:group_id] = 'MyUniqueGroupId'
|
35
|
+
total.times do |count|
|
36
|
+
# new_id => true causes subsequent messages to have unique message and
|
37
|
+
# correlation id's. Otherwise all messages will have the same message and
|
38
|
+
# correlation id's since the same message object is being
|
39
|
+
# re-used for all put calls
|
40
|
+
message.data = "Hello:#{count}"
|
41
|
+
|
42
|
+
# Set the message flag to indicate message is in a group
|
43
|
+
# On the last message, set the last message flag
|
44
|
+
message.descriptor[:msg_flags] = (count < total-1) ? WMQ::MQMF_MSG_IN_GROUP : WMQ::MQMF_LAST_MSG_IN_GROUP
|
45
|
+
message.descriptor[:msg_seq_number] = count + 1
|
46
|
+
|
47
|
+
# By setting the put :options => WMQ::MQPMO_LOGICAL_ORDER then MQ will supply a unique Group Id
|
48
|
+
# and MQ will automatically set the message sequence number for us.
|
49
|
+
queue.put(:message => message, :new_id => true)
|
50
|
+
p message.descriptor
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/examples/put_rfh.rb
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
# Sample : put() : Put a message to a queue with a Refernce header
|
19
19
|
# Open the queue so that multiple puts can be performed
|
20
20
|
#
|
21
|
+
require 'rubygems'
|
21
22
|
require 'wmq/wmq'
|
22
23
|
|
23
24
|
# The Rules Format header (MQRFH) allows a list of name value pairs to be sent along
|
data/examples/put_rfh2_a.rb
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
# Sample : put() : Put a message to a queue with a Refernce header
|
19
19
|
# Open the queue so that multiple puts can be performed
|
20
20
|
#
|
21
|
+
require 'rubygems'
|
21
22
|
require 'wmq/wmq'
|
22
23
|
|
23
24
|
# The Rules Format header2 (MQRFH2) allows a an XML-like string to be passed as a header
|
data/examples/put_rfh2_b.rb
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
# Sample : put() : Put a message to a queue with a Refernce header
|
19
19
|
# Open the queue so that multiple puts can be performed
|
20
20
|
#
|
21
|
+
require 'rubygems'
|
21
22
|
require 'wmq/wmq'
|
22
23
|
|
23
24
|
# The Rules Format header2 (MQRFH2) allows a an XML-like string to be passed as a header
|
data/examples/put_xmit_q.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
################################################################################
|
16
|
+
|
17
|
+
#
|
18
|
+
# Example: q_to_files: Copy all messages in a queue to separate files in a directory
|
19
|
+
#
|
20
|
+
require 'rubygems'
|
21
|
+
require 'find'
|
22
|
+
require 'yaml'
|
23
|
+
require 'wmq/wmq'
|
24
|
+
require 'fileutils'
|
25
|
+
|
26
|
+
# Call program passing environment name as first parameter
|
27
|
+
# The environment corresponds to an entry in the config file
|
28
|
+
env = ARGV[0] || raise("Command line argument 'environment' is required")
|
29
|
+
config = YAML::load_file('q_to_files.cfg')[env]
|
30
|
+
|
31
|
+
# Create supplied path if it does not exist
|
32
|
+
path = config['target_directory']
|
33
|
+
FileUtils.mkdir_p(path)
|
34
|
+
|
35
|
+
message = WMQ::Message.new
|
36
|
+
message.descriptor = config['descriptor'] || {}
|
37
|
+
tstart = Time.now
|
38
|
+
counter = 0
|
39
|
+
WMQ::QueueManager.connect(config['qmgr_options']) do |qmgr|
|
40
|
+
qmgr.open_queue(config['input_queue']) do |queue|
|
41
|
+
queue.each do |message|
|
42
|
+
counter = counter + 1
|
43
|
+
File.open(File.join(path, "message_%03d" % counter), 'w') {|file| file.write(message.data) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
duration = Time.now - tstart
|
48
|
+
printf "Processed #{counter} messages in %.3f seconds. Average: %.3f messages/second\n", duration, counter/duration
|
data/examples/request.rb
CHANGED
data/examples/server.rb
CHANGED
data/ext/build.sh
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
ruby extconf.rb --with-mqm-include=/opt/mqm/inc --with-mqm-lib=/opt/mqm/lib
|
2
|
-
make
|
3
|
-
# Uncomment the following lines for platforms other than Solaris, Windows and Linux
|
4
|
-
#ruby extconf_client.rb --with-mqm-include=/opt/mqm/inc --with-mqm-lib=/opt/mqm/lib
|
5
|
-
#make
|
1
|
+
ruby extconf.rb --with-mqm-include=/opt/mqm/inc --with-mqm-lib=/opt/mqm/lib
|
2
|
+
make
|
3
|
+
# Uncomment the following lines for platforms other than Solaris, Windows and Linux
|
4
|
+
#ruby extconf_client.rb --with-mqm-include=/opt/mqm/inc --with-mqm-lib=/opt/mqm/lib
|
5
|
+
#make
|
6
|
+
|
data/ext/extconf.rb
CHANGED
@@ -85,7 +85,7 @@ END_OF_STRING
|
|
85
85
|
end
|
86
86
|
str << <<END_OF_STRING
|
87
87
|
}
|
88
|
-
printf("WMQ::wmq_reason Unknown Reason code:%ld\\n",reason_code);
|
88
|
+
printf("WMQ::wmq_reason Unknown Reason code:%ld\\n",(long)reason_code);
|
89
89
|
return "Unknown reason code";
|
90
90
|
}
|
91
91
|
|
@@ -101,11 +101,14 @@ END_OF_STRING
|
|
101
101
|
'MQIACH_BYTES_RCVD',
|
102
102
|
'MQIACH_BUFFERS_RCVD']],
|
103
103
|
['cmqcfc.h', 'MQIAMO_'],
|
104
|
-
['cmqcfc.h', 'MQIAMO64_'
|
104
|
+
['cmqcfc.h', 'MQIAMO64_', ['MQIAMO64_AVG_Q_TIME',
|
105
|
+
'MQIAMO64_Q_TIME_AVG',
|
106
|
+
'MQIAMO64_Q_TIME_MAX',
|
107
|
+
'MQIAMO64_Q_TIME_MIN']],
|
105
108
|
# Integer System Selectors
|
106
109
|
['cmqbc.h', 'MQIASY_'],
|
107
110
|
# Character Selectors for Object Attributes
|
108
|
-
['cmqc.h', 'MQCA_'],
|
111
|
+
['cmqc.h', 'MQCA_',['MQCA_BASE_OBJECT_NAME']],
|
109
112
|
['cmqcfc.h', 'MQCACF_'],
|
110
113
|
['cmqcfc.h', 'MQCACH_'],
|
111
114
|
['cmqcfc.h', 'MQCAMO_'],
|
@@ -138,7 +141,7 @@ ID wmq_selector_id(MQLONG selector)
|
|
138
141
|
{
|
139
142
|
#{str_switch}
|
140
143
|
}
|
141
|
-
printf("WMQ::wmq_select_text Unknown Selector:%ld\\n",selector);
|
144
|
+
printf("WMQ::wmq_select_text Unknown Selector:%ld\\n",(long)selector);
|
142
145
|
return rb_intern("unknown_selector_code");
|
143
146
|
}
|
144
147
|
|
@@ -152,12 +155,15 @@ END_OF_STRING
|
|
152
155
|
# Integer Selectors for Object Attributes
|
153
156
|
[['cmqc.h', 'MQIA_'],
|
154
157
|
['cmqcfc.h', 'MQIACF_', ['MQIACF_ERROR_ID',
|
155
|
-
|
158
|
+
'MQIACF_QUIESCE']],
|
156
159
|
['cmqcfc.h', 'MQIACH_', ['MQIACH_CURRENT_SEQ_NUMBER',
|
157
|
-
|
158
|
-
|
160
|
+
'MQIACH_BYTES_RCVD',
|
161
|
+
'MQIACH_BUFFERS_RCVD']],
|
159
162
|
['cmqcfc.h', 'MQIAMO_'],
|
160
|
-
['cmqcfc.h', 'MQIAMO64_'
|
163
|
+
['cmqcfc.h', 'MQIAMO64_', ['MQIAMO64_AVG_Q_TIME',
|
164
|
+
'MQIAMO64_Q_TIME_AVG',
|
165
|
+
'MQIAMO64_Q_TIME_MAX',
|
166
|
+
'MQIAMO64_Q_TIME_MIN']],
|
161
167
|
# Integer System Selectors
|
162
168
|
# ['cmqbc.h', 'MQIASY_'],
|
163
169
|
].each do |item|
|
@@ -168,7 +174,7 @@ END_OF_STRING
|
|
168
174
|
end
|
169
175
|
str << "\n *selector_type = MQIT_STRING;\n\n"
|
170
176
|
# Character Selectors for Object Attributes
|
171
|
-
|
177
|
+
[['cmqc.h', 'MQCA_',['MQCA_BASE_OBJECT_NAME']],
|
172
178
|
['cmqcfc.h', 'MQCACF_'],
|
173
179
|
['cmqcfc.h', 'MQCACH_'],
|
174
180
|
['cmqcfc.h', 'MQCAMO_'],
|
@@ -28,7 +28,6 @@ class GenerateStructs
|
|
28
28
|
def extract_struct (filename, struct_name)
|
29
29
|
properties_list = []
|
30
30
|
line_number = 0
|
31
|
-
group_name = nil
|
32
31
|
found = false
|
33
32
|
File.open(filename) do |file|
|
34
33
|
file.each do |line|
|
@@ -40,7 +39,6 @@ class GenerateStructs
|
|
40
39
|
found = true if line =~ /^\s*struct\s*tag#{struct_name}/
|
41
40
|
else
|
42
41
|
return(properties_list) if line =~ /^\s*\};/
|
43
|
-
#puts line
|
44
42
|
match = /\s*(MQ\w+)\s+(\w+);/.match(line)
|
45
43
|
if match
|
46
44
|
type = match[1]
|
@@ -263,9 +263,9 @@ void Message_deblock(VALUE self, PMQMD pmqmd, PMQBYTE p_buffer, MQLONG total_len
|
|
263
263
|
|
264
264
|
if(memcmp(p_header->StrucId, <%=struct[:struct_id] || "#{struct[:struct].upcase}_STRUC_ID"%>, sizeof(p_header->StrucId)) != 0)
|
265
265
|
{
|
266
|
-
break; /* Bad Message received, do not deblock headers */
|
267
266
|
if(trace_level>1)
|
268
267
|
printf("WMQ::Message#deblock MQFMT_<%=struct[:header].upcase%> received, but message does not contain <%=struct[:struct].upcase%>\n");
|
268
|
+
break; /* Bad Message received, do not deblock headers */
|
269
269
|
}
|
270
270
|
else
|
271
271
|
{
|
@@ -367,7 +367,7 @@ int Message_build_header (VALUE hash, struct Message_build_header_arg* parg)
|
|
367
367
|
*(parg->p_data_offset) += sizeof(<%=struct[:struct]%>);
|
368
368
|
|
369
369
|
if(parg->trace_level>2)
|
370
|
-
printf ("WMQ::Message#build_header data offset:%ld\n", *(parg->p_data_offset));
|
370
|
+
printf ("WMQ::Message#build_header data offset:%ld\n", (long)(*(parg->p_data_offset)));
|
371
371
|
<% end
|
372
372
|
%> }
|
373
373
|
else
|
data/ext/wmq.c
CHANGED
data/ext/wmq.h
CHANGED
@@ -188,6 +188,32 @@ void to_mqdlh(VALUE hash, MQDLH* pmqdlh);
|
|
188
188
|
void from_mqdlh(VALUE hash, MQDLH* pmqdlh);
|
189
189
|
|
190
190
|
void wmq_structs_id_init();
|
191
|
+
void Message_to_mqmd(VALUE hash, MQMD* pmqmd);
|
192
|
+
void Message_to_mqmd1(VALUE hash, MQMD1* pmqmd1);
|
193
|
+
void Message_to_mqrfh2(VALUE hash, MQRFH2* pmqrfh2);
|
194
|
+
void Message_to_mqrfh(VALUE hash, MQRFH* pmqrfh);
|
195
|
+
void Message_to_mqdlh(VALUE hash, MQDLH* pmqdlh);
|
196
|
+
void Message_to_mqcih(VALUE hash, MQCIH* pmqcih);
|
197
|
+
void Message_to_mqdh(VALUE hash, MQDH* pmqdh);
|
198
|
+
void Message_to_mqiih(VALUE hash, MQIIH* pmqiih);
|
199
|
+
void Message_to_mqrmh(VALUE hash, MQRMH* pmqrmh);
|
200
|
+
void Message_to_mqtm(VALUE hash, MQTM* pmqtm);
|
201
|
+
void Message_to_mqtmc2(VALUE hash, MQTMC2* pmqtmc2);
|
202
|
+
void Message_to_mqwih(VALUE hash, MQWIH* pmqwih);
|
203
|
+
void Message_to_mqxqh(VALUE hash, MQXQH* pmqxqh);
|
204
|
+
void Message_from_mqmd(VALUE hash, MQMD* pmqmd);
|
205
|
+
void Message_from_mqmd1(VALUE hash, MQMD1* pmqmd1);
|
206
|
+
void Message_from_mqrfh2(VALUE hash, MQRFH2* pmqrfh2);
|
207
|
+
void Message_from_mqrfh(VALUE hash, MQRFH* pmqrfh);
|
208
|
+
void Message_from_mqdlh(VALUE hash, MQDLH* pmqdlh);
|
209
|
+
void Message_from_mqcih(VALUE hash, MQCIH* pmqcih);
|
210
|
+
void Message_from_mqdh(VALUE hash, MQDH* pmqdh);
|
211
|
+
void Message_from_mqiih(VALUE hash, MQIIH* pmqiih);
|
212
|
+
void Message_from_mqrmh(VALUE hash, MQRMH* pmqrmh);
|
213
|
+
void Message_from_mqtm(VALUE hash, MQTM* pmqtm);
|
214
|
+
void Message_from_mqtmc2(VALUE hash, MQTMC2* pmqtmc2);
|
215
|
+
void Message_from_mqwih(VALUE hash, MQWIH* pmqwih);
|
216
|
+
void Message_from_mqxqh(VALUE hash, MQXQH* pmqxqh);
|
191
217
|
|
192
218
|
char* wmq_reason(MQLONG reason_code);
|
193
219
|
ID wmq_selector_id(MQLONG selector);
|
@@ -242,7 +268,7 @@ void wmq_selector(ID selector_id, PMQLONG selector_type, PMQLONG selector);
|
|
242
268
|
val = rb_hash_aref(HASH, ID2SYM(ID_##KEY)); \
|
243
269
|
if (!NIL_P(val)) \
|
244
270
|
{ \
|
245
|
-
WMQ_STR2MQBYTES(val,ELEMENT)
|
271
|
+
WMQ_STR2MQBYTES(val,ELEMENT) \
|
246
272
|
}
|
247
273
|
|
248
274
|
#define WMQ_HASH2BOOL(HASH,KEY,ELEMENT) \
|
data/ext/wmq_message.c
CHANGED
@@ -88,7 +88,6 @@ void Message_build(PMQBYTE* pq_pp_buffer, PMQLONG pq_p_buffer_size, MQLONG trace
|
|
88
88
|
if ( !NIL_P(headers) &&
|
89
89
|
(NUM2LONG(rb_funcall(headers, ID_size, 0))>0) )
|
90
90
|
{
|
91
|
-
PMQBYTE p_data = 0;
|
92
91
|
MQLONG data_offset = 0;
|
93
92
|
struct Message_build_header_arg arg;
|
94
93
|
VALUE next_header;
|
@@ -96,7 +95,6 @@ void Message_build(PMQBYTE* pq_pp_buffer, PMQLONG pq_p_buffer_size, MQLONG trace
|
|
96
95
|
VALUE header_type;
|
97
96
|
VALUE ind_val;
|
98
97
|
size_t index;
|
99
|
-
ID first_header_id;
|
100
98
|
|
101
99
|
if(trace_level>2)
|
102
100
|
printf ("WMQ::Queue#put %ld Header(s) supplied\n", NUM2LONG(rb_funcall(headers, ID_size, 0)));
|
@@ -106,11 +104,11 @@ void Message_build(PMQBYTE* pq_pp_buffer, PMQLONG pq_p_buffer_size, MQLONG trace
|
|
106
104
|
{
|
107
105
|
MQLONG new_size = RSTRING(data)->len + 512; /* Add space for data and a header */
|
108
106
|
if(trace_level>2)
|
109
|
-
printf ("WMQ::Queue#reallocate Resizing buffer from %ld to %ld bytes\n", *pq_p_buffer_size, new_size);
|
107
|
+
printf ("WMQ::Queue#reallocate Resizing buffer from %ld to %ld bytes\n", *pq_p_buffer_size, (long)new_size);
|
110
108
|
|
111
109
|
*pq_p_buffer_size = new_size;
|
112
110
|
free(*pq_pp_buffer);
|
113
|
-
*pq_pp_buffer = ALLOC_N(char, new_size);
|
111
|
+
*pq_pp_buffer = ALLOC_N(unsigned char, new_size);
|
114
112
|
}
|
115
113
|
|
116
114
|
arg.pp_buffer = pq_pp_buffer;
|
@@ -160,7 +158,7 @@ void Message_build(PMQBYTE* pq_pp_buffer, PMQLONG pq_p_buffer_size, MQLONG trace
|
|
160
158
|
}
|
161
159
|
|
162
160
|
if(trace_level>2)
|
163
|
-
printf ("WMQ::Queue#put done building headers. Offset is now %ld\n", arg.p_data_offset);
|
161
|
+
printf ("WMQ::Queue#put done building headers. Offset is now %ld\n", *arg.p_data_offset);
|
164
162
|
|
165
163
|
memcpy((*pq_pp_buffer) + data_offset, RSTRING(data)->ptr, RSTRING(data)->len);
|
166
164
|
*p_total_length = data_offset + RSTRING(data)->len;
|
@@ -210,7 +208,6 @@ void Message_build_mqmd(VALUE self, PMQMD pmqmd)
|
|
210
208
|
VALUE Message_initialize(int argc, VALUE *argv, VALUE self)
|
211
209
|
{
|
212
210
|
VALUE parms = Qnil;
|
213
|
-
VALUE proc = Qnil;
|
214
211
|
|
215
212
|
/* Extract optional parameter */
|
216
213
|
rb_scan_args(argc, argv, "01", &parms);
|
@@ -285,7 +282,7 @@ PMQBYTE Message_autogrow_data_buffer(struct Message_build_header_arg* parg, MQLO
|
|
285
282
|
size += 512; /* Additional space for subsequent headers */
|
286
283
|
|
287
284
|
if(parg->trace_level>2)
|
288
|
-
printf ("WMQ::Message Reallocating buffer from %ld to %ld\n", *(parg->p_buffer_size), size);
|
285
|
+
printf ("WMQ::Message Reallocating buffer from %ld to %ld\n", *(parg->p_buffer_size), (long)size);
|
289
286
|
|
290
287
|
*(parg->p_buffer_size) = size;
|
291
288
|
*(parg->pp_buffer) = ALLOC_N(char, size);
|
@@ -384,7 +381,6 @@ void Message_build_rf_header (VALUE hash, struct Message_build_header_arg* parg)
|
|
384
381
|
MQLONG name_value_len = 0;
|
385
382
|
PMQCHAR p_name_value = 0;
|
386
383
|
VALUE name_value = rb_hash_aref(hash, ID2SYM(ID_name_value));
|
387
|
-
MQLONG pad = 0;
|
388
384
|
|
389
385
|
MQRFH_DEF.CodedCharSetId = MQCCSI_INHERIT;
|
390
386
|
|
@@ -441,7 +437,7 @@ void Message_build_rf_header (VALUE hash, struct Message_build_header_arg* parg)
|
|
441
437
|
}
|
442
438
|
|
443
439
|
if(parg->trace_level>3)
|
444
|
-
printf ("WMQ::Message#build_rf_header Sizeof namevalue string:%ld\n", name_value_len);
|
440
|
+
printf ("WMQ::Message#build_rf_header Sizeof namevalue string:%ld\n", (long)name_value_len);
|
445
441
|
|
446
442
|
if(parg->trace_level>2)
|
447
443
|
printf ("WMQ::Message#build_rf_header data offset:%ld\n", *(parg->p_data_offset));
|
@@ -494,7 +490,7 @@ MQLONG Message_deblock_rf_header (VALUE hash, PMQBYTE p_data, MQLONG data_len)
|
|
494
490
|
|
495
491
|
rfh_toktype_t toktype;
|
496
492
|
|
497
|
-
if(size > data_len)
|
493
|
+
if(size < 0 || size > data_len) /* Poison Message */
|
498
494
|
{
|
499
495
|
printf("WMQ::Message_deblock_rf_header StrucLength supplied in MQRFH exceeds total message length\n");
|
500
496
|
return 0;
|
@@ -537,7 +533,7 @@ MQLONG Message_deblock_rf_header_2 (VALUE hash, PMQBYTE p_buffer, MQLONG data_le
|
|
537
533
|
size_t length;
|
538
534
|
size_t i;
|
539
535
|
|
540
|
-
if(size > data_len)
|
536
|
+
if(size < 0 || size > data_len) /* Poison Message */
|
541
537
|
{
|
542
538
|
printf("WMQ::Message_deblock_rf_header_2 StrucLength supplied in MQRFH exceeds total message length\n");
|
543
539
|
return 0;
|
@@ -550,7 +546,7 @@ MQLONG Message_deblock_rf_header_2 (VALUE hash, PMQBYTE p_buffer, MQLONG data_le
|
|
550
546
|
xml_len = *(PMQLONG)p_data;
|
551
547
|
p_data += sizeof(MQLONG);
|
552
548
|
|
553
|
-
if (p_data+xml_len > p_end)
|
549
|
+
if (xml_len < 0 || p_data+xml_len > p_end)
|
554
550
|
{
|
555
551
|
printf("WMQ::Message#deblock_rf_header_2 Poison Message received, stopping further processing\n");
|
556
552
|
p_data = p_end;
|
data/ext/wmq_mq_load.c
CHANGED
data/ext/wmq_queue.c
CHANGED
@@ -146,7 +146,7 @@ VALUE QUEUE_alloc(VALUE klass)
|
|
146
146
|
pq->fail_if_exists = 1;
|
147
147
|
memset(&pq->q_name, 0, sizeof(pq->q_name));
|
148
148
|
pq->buffer_size = 16384;
|
149
|
-
pq->p_buffer = ALLOC_N(char, pq->buffer_size);
|
149
|
+
pq->p_buffer = ALLOC_N(unsigned char, pq->buffer_size);
|
150
150
|
|
151
151
|
return Data_Wrap_Struct(klass, 0, QUEUE_free, pq);
|
152
152
|
}
|
@@ -203,6 +203,11 @@ void Queue_extract_put_message_options(VALUE hash, PMQPMO ppmo)
|
|
203
203
|
ppmo->Options |= MQPMO_SYNCPOINT;
|
204
204
|
}
|
205
205
|
|
206
|
+
IF_TRUE(fail_if_quiescing, 1) /* Defaults to true */
|
207
|
+
{
|
208
|
+
ppmo->Options |= MQPMO_FAIL_IF_QUIESCING;
|
209
|
+
}
|
210
|
+
|
206
211
|
IF_TRUE(new_id, 0) /* :new_id */
|
207
212
|
{
|
208
213
|
ppmo->Options |= MQPMO_NEW_MSG_ID;
|
@@ -308,10 +313,7 @@ VALUE Queue_initialize(VALUE self, VALUE hash)
|
|
308
313
|
if(pq->trace_level > 1) printf("WMQ::Queue::new Queue:%s\n", pq->q_name);
|
309
314
|
|
310
315
|
val = rb_hash_aref(hash, ID2SYM(ID_dynamic_q_name)); /* :dynamic_q_name */
|
311
|
-
|
312
|
-
{
|
313
|
-
rb_iv_set(self, "@dynamic_q_name", val);
|
314
|
-
}
|
316
|
+
rb_iv_set(self, "@dynamic_q_name", val);
|
315
317
|
|
316
318
|
WMQ_HASH2MQBYTES(hash,alternate_security_id, pq->od.AlternateSecurityId)
|
317
319
|
WMQ_HASH2MQLONG(hash,close_options, pq->close_options)
|
@@ -439,7 +441,7 @@ VALUE Queue_open(VALUE self)
|
|
439
441
|
pq->hcon = pqm->hcon; /* Store Queue Manager handle for subsequent calls */
|
440
442
|
|
441
443
|
if(pq->trace_level)
|
442
|
-
printf ("WMQ::Queue#open() Opening Queue:%s, Queue Manager Handle:%
|
444
|
+
printf ("WMQ::Queue#open() Opening Queue:%s, Queue Manager Handle:%ld\n", RSTRING(name)->ptr, (long)pq->hcon);
|
443
445
|
|
444
446
|
if(pq->hobj) /* Close queue if already open, ignore errors */
|
445
447
|
{
|
@@ -470,9 +472,9 @@ VALUE Queue_open(VALUE self)
|
|
470
472
|
}
|
471
473
|
|
472
474
|
if(pq->trace_level)
|
473
|
-
printf("WMQ::Queue#open() MQOPEN completed with reason:%s, Handle:%
|
475
|
+
printf("WMQ::Queue#open() MQOPEN completed with reason:%s, Handle:%ld\n",
|
474
476
|
wmq_reason(pq->reason_code),
|
475
|
-
pq->hobj);
|
477
|
+
(long)pq->hobj);
|
476
478
|
|
477
479
|
if (pq->comp_code == MQCC_FAILED)
|
478
480
|
{
|
@@ -539,7 +541,7 @@ VALUE Queue_close(VALUE self)
|
|
539
541
|
return Qtrue;
|
540
542
|
}
|
541
543
|
|
542
|
-
if(pq->trace_level) printf ("WMQ::Queue#close() Queue Handle:%ld, Queue Manager Handle:%ld\n", pq->hobj, pq->hcon);
|
544
|
+
if(pq->trace_level) printf ("WMQ::Queue#close() Queue Handle:%ld, Queue Manager Handle:%ld\n", (long)pq->hobj, (long)pq->hcon);
|
543
545
|
|
544
546
|
pq->MQCLOSE(pq->hcon, &pq->hobj, pq->close_options, &pq->comp_code, &pq->reason_code);
|
545
547
|
|
@@ -680,11 +682,7 @@ VALUE Queue_close(VALUE self)
|
|
680
682
|
*/
|
681
683
|
VALUE Queue_get(VALUE self, VALUE hash)
|
682
684
|
{
|
683
|
-
VALUE handle;
|
684
685
|
VALUE val;
|
685
|
-
VALUE str;
|
686
|
-
VALUE descriptor;
|
687
|
-
VALUE data;
|
688
686
|
VALUE message;
|
689
687
|
PQUEUE pq;
|
690
688
|
MQLONG flag;
|
@@ -693,6 +691,7 @@ VALUE Queue_get(VALUE self, VALUE hash)
|
|
693
691
|
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
|
694
692
|
MQGMO gmo = {MQGMO_DEFAULT}; /* get message options */
|
695
693
|
|
694
|
+
md.Version = MQMD_CURRENT_VERSION; /* Allow Group Options */
|
696
695
|
gmo.Version = MQGMO_CURRENT_VERSION; /* Allow MatchOptions */
|
697
696
|
|
698
697
|
Check_Type(hash, T_HASH);
|
@@ -743,8 +742,8 @@ VALUE Queue_get(VALUE self, VALUE hash)
|
|
743
742
|
|
744
743
|
WMQ_HASH2MQLONG(hash,match, gmo.MatchOptions) /* :match */
|
745
744
|
|
746
|
-
if(pq->trace_level > 1) printf("WMQ::Queue#get() Get Message Option: MatchOptions=%ld\n", gmo.MatchOptions);
|
747
|
-
if(pq->trace_level) printf("WMQ::Queue#get() Queue Handle:%ld, Queue Manager Handle:%ld\n", pq->hobj, pq->hcon);
|
745
|
+
if(pq->trace_level > 1) printf("WMQ::Queue#get() Get Message Option: MatchOptions=%ld\n", (long)gmo.MatchOptions);
|
746
|
+
if(pq->trace_level) printf("WMQ::Queue#get() Queue Handle:%ld, Queue Manager Handle:%ld\n", (long)pq->hobj, (long)pq->hcon);
|
748
747
|
|
749
748
|
/* If descriptor is re-used
|
750
749
|
|
@@ -775,16 +774,16 @@ VALUE Queue_get(VALUE self, VALUE hash)
|
|
775
774
|
/* report reason, if any */
|
776
775
|
if (pq->reason_code != MQRC_NONE)
|
777
776
|
{
|
778
|
-
if(pq->trace_level>1) printf("WMQ::Queue#get() Growing buffer size from %ld to %ld\n", pq->buffer_size, messlen);
|
777
|
+
if(pq->trace_level>1) printf("WMQ::Queue#get() Growing buffer size from %ld to %ld\n", (long)pq->buffer_size, (long)messlen);
|
779
778
|
/* TODO: Add support for autogrow buffer here */
|
780
779
|
if (pq->reason_code == MQRC_TRUNCATED_MSG_FAILED)
|
781
780
|
{
|
782
781
|
if(pq->trace_level>2)
|
783
|
-
printf ("WMQ::Queue#reallocate Resizing buffer from %ld to %ld bytes\n", pq->buffer_size, messlen);
|
782
|
+
printf ("WMQ::Queue#reallocate Resizing buffer from %ld to %ld bytes\n", (long)pq->buffer_size, (long)messlen);
|
784
783
|
|
785
784
|
free(pq->p_buffer);
|
786
785
|
pq->buffer_size = messlen;
|
787
|
-
pq->p_buffer = ALLOC_N(char, messlen);
|
786
|
+
pq->p_buffer = ALLOC_N(unsigned char, messlen);
|
788
787
|
}
|
789
788
|
}
|
790
789
|
}
|
@@ -953,6 +952,8 @@ VALUE Queue_put(VALUE self, VALUE hash)
|
|
953
952
|
MQLONG BufferLength = 0; /* Length of the message in Buffer */
|
954
953
|
PMQVOID pBuffer = 0; /* Message data */
|
955
954
|
|
955
|
+
md.Version = MQMD_CURRENT_VERSION; /* Allow Group Options */
|
956
|
+
|
956
957
|
Check_Type(hash, T_HASH);
|
957
958
|
|
958
959
|
Data_Get_Struct(self, QUEUE, pq);
|
@@ -967,7 +968,7 @@ VALUE Queue_put(VALUE self, VALUE hash)
|
|
967
968
|
Message_build(&pq->p_buffer, &pq->buffer_size, pq->trace_level,
|
968
969
|
hash, &pBuffer, &BufferLength, &md);
|
969
970
|
|
970
|
-
if(pq->trace_level) printf("WMQ::Queue#put() Queue Handle:%ld, Queue Manager Handle:%ld\n", pq->hobj, pq->hcon);
|
971
|
+
if(pq->trace_level) printf("WMQ::Queue#put() Queue Handle:%ld, Queue Manager Handle:%ld\n", (long)pq->hobj, (long)pq->hcon);
|
971
972
|
|
972
973
|
pq->MQPUT(
|
973
974
|
pq->hcon, /* connection handle */
|
@@ -1306,7 +1307,7 @@ VALUE Queue_each(int argc, VALUE *argv, VALUE self)
|
|
1306
1307
|
}
|
1307
1308
|
rb_hash_aset(hash, ID2SYM(ID_options), LONG2NUM(get_options));
|
1308
1309
|
|
1309
|
-
if(pq->trace_level>1) printf("WMQ::Queue#each MQGMO_BROWSE_FIRST set, get options:%ld\n", get_options);
|
1310
|
+
if(pq->trace_level>1) printf("WMQ::Queue#each MQGMO_BROWSE_FIRST set, get options:%ld\n", (long)get_options);
|
1310
1311
|
browse = 1;
|
1311
1312
|
}
|
1312
1313
|
|
@@ -1330,7 +1331,7 @@ VALUE Queue_each(int argc, VALUE *argv, VALUE self)
|
|
1330
1331
|
}
|
1331
1332
|
rb_hash_aset(hash, ID2SYM(ID_options), LONG2NUM(get_options));
|
1332
1333
|
|
1333
|
-
if(pq->trace_level>1) printf("WMQ::Queue#each MQGMO_BROWSE_NEXT set, get options:%ld\n", get_options);
|
1334
|
+
if(pq->trace_level>1) printf("WMQ::Queue#each MQGMO_BROWSE_NEXT set, get options:%ld\n", (long)get_options);
|
1334
1335
|
}
|
1335
1336
|
}
|
1336
1337
|
|
data/ext/wmq_queue_manager.c
CHANGED
@@ -20,7 +20,6 @@ static ID ID_open;
|
|
20
20
|
static ID ID_call;
|
21
21
|
static ID ID_new;
|
22
22
|
static ID ID_backout;
|
23
|
-
static ID ID_any_message;
|
24
23
|
static ID ID_connect_options;
|
25
24
|
static ID ID_q_mgr_name;
|
26
25
|
static ID ID_queue_manager;
|
@@ -217,9 +216,7 @@ VALUE QueueManager_initialize(VALUE self, VALUE hash)
|
|
217
216
|
VALUE str;
|
218
217
|
size_t size;
|
219
218
|
size_t length;
|
220
|
-
size_t i;
|
221
219
|
PQUEUE_MANAGER pqm;
|
222
|
-
char* pChar;
|
223
220
|
|
224
221
|
Check_Type(hash, T_HASH);
|
225
222
|
|
@@ -393,9 +390,6 @@ VALUE QueueManager_initialize(VALUE self, VALUE hash)
|
|
393
390
|
VALUE QueueManager_connect(VALUE self)
|
394
391
|
{
|
395
392
|
VALUE name;
|
396
|
-
VALUE str;
|
397
|
-
VALUE val;
|
398
|
-
VALUE hash;
|
399
393
|
|
400
394
|
PQUEUE_MANAGER pqm;
|
401
395
|
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
@@ -425,9 +419,9 @@ VALUE QueueManager_connect(VALUE self)
|
|
425
419
|
&pqm->reason_code); /* connect reason code */
|
426
420
|
|
427
421
|
if(pqm->trace_level)
|
428
|
-
printf("WMQ::QueueManager#connect() MQCONNX completed with reason:%s, Handle:%
|
422
|
+
printf("WMQ::QueueManager#connect() MQCONNX completed with reason:%s, Handle:%ld\n",
|
429
423
|
wmq_reason(pqm->reason_code),
|
430
|
-
pqm->hcon);
|
424
|
+
(long)pqm->hcon);
|
431
425
|
|
432
426
|
if (pqm->comp_code == MQCC_FAILED)
|
433
427
|
{
|
@@ -473,7 +467,7 @@ VALUE QueueManager_disconnect(VALUE self)
|
|
473
467
|
PQUEUE_MANAGER pqm;
|
474
468
|
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
475
469
|
|
476
|
-
if(pqm->trace_level) printf ("WMQ::QueueManager#disconnect() Queue Manager Handle:%ld\n", pqm->hcon);
|
470
|
+
if(pqm->trace_level) printf ("WMQ::QueueManager#disconnect() Queue Manager Handle:%ld\n", (long)pqm->hcon);
|
477
471
|
|
478
472
|
if (!pqm->already_connected)
|
479
473
|
{
|
@@ -534,7 +528,7 @@ VALUE QueueManager_commit(VALUE self)
|
|
534
528
|
PQUEUE_MANAGER pqm;
|
535
529
|
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
536
530
|
|
537
|
-
if(pqm->trace_level) printf ("WMQ::QueueManager#commit() Queue Manager Handle:%ld\n", pqm->hcon);
|
531
|
+
if(pqm->trace_level) printf ("WMQ::QueueManager#commit() Queue Manager Handle:%ld\n", (long)pqm->hcon);
|
538
532
|
|
539
533
|
pqm->MQCMIT(pqm->hcon, &pqm->comp_code, &pqm->reason_code);
|
540
534
|
|
@@ -586,7 +580,7 @@ VALUE QueueManager_backout(VALUE self)
|
|
586
580
|
PQUEUE_MANAGER pqm;
|
587
581
|
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
588
582
|
|
589
|
-
if(pqm->trace_level) printf ("WMQ::QueueManager#backout() Queue Manager Handle:%ld\n", pqm->hcon);
|
583
|
+
if(pqm->trace_level) printf ("WMQ::QueueManager#backout() Queue Manager Handle:%ld\n", (long)pqm->hcon);
|
590
584
|
|
591
585
|
pqm->MQBACK(pqm->hcon, &pqm->comp_code, &pqm->reason_code);
|
592
586
|
|
@@ -636,7 +630,7 @@ VALUE QueueManager_begin(VALUE self)
|
|
636
630
|
PQUEUE_MANAGER pqm;
|
637
631
|
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
638
632
|
|
639
|
-
if(pqm->trace_level) printf ("WMQ::QueueManager#begin() Queue Manager Handle:%ld\n", pqm->hcon);
|
633
|
+
if(pqm->trace_level) printf ("WMQ::QueueManager#begin() Queue Manager Handle:%ld\n", (long)pqm->hcon);
|
640
634
|
|
641
635
|
pqm->MQBEGIN(pqm->hcon, 0, &pqm->comp_code, &pqm->reason_code);
|
642
636
|
|
@@ -791,10 +785,6 @@ VALUE QueueManager_put(VALUE self, VALUE hash)
|
|
791
785
|
{
|
792
786
|
MQLONG BufferLength; /* Length of the message in Buffer */
|
793
787
|
PMQVOID pBuffer; /* Message data */
|
794
|
-
/*-----------------10/22/2006 7:11PM----------------
|
795
|
-
* TODO: Need dynamic buffer here!
|
796
|
-
* --------------------------------------------------*/
|
797
|
-
MQBYTE header_buffer[65535]; /* message buffer for header use */
|
798
788
|
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
|
799
789
|
MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */
|
800
790
|
MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
|
@@ -838,7 +828,7 @@ VALUE QueueManager_put(VALUE self, VALUE hash)
|
|
838
828
|
Message_build(&pqm->p_buffer, &pqm->buffer_size, pqm->trace_level,
|
839
829
|
hash, &pBuffer, &BufferLength, &md);
|
840
830
|
|
841
|
-
if(pqm->trace_level) printf("WMQ::QueueManager#put Queue Manager Handle:%ld\n", pqm->hcon);
|
831
|
+
if(pqm->trace_level) printf("WMQ::QueueManager#put Queue Manager Handle:%ld\n", (long)pqm->hcon);
|
842
832
|
|
843
833
|
pqm->MQPUT1(
|
844
834
|
pqm->hcon, /* connection handle */
|
@@ -1045,7 +1035,6 @@ static VALUE QueueManager_singleton_connect_rescue(VALUE self)
|
|
1045
1035
|
{
|
1046
1036
|
PQUEUE_MANAGER pqm;
|
1047
1037
|
VALUE exception;
|
1048
|
-
MQLONG command = 0;
|
1049
1038
|
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
1050
1039
|
|
1051
1040
|
if(pqm->trace_level) printf("WMQ::QueueManager.connect() Backing out due to unhandled exception\n");
|
@@ -1382,7 +1371,7 @@ static int QueueManager_execute_each (VALUE array, PQUEUE_MANAGER pqm)
|
|
1382
1371
|
VALUE QueueManager_execute(VALUE self, VALUE hash)
|
1383
1372
|
{
|
1384
1373
|
#ifdef MQHB_UNUSABLE_HBAG
|
1385
|
-
VALUE val
|
1374
|
+
VALUE val;
|
1386
1375
|
PQUEUE_MANAGER pqm;
|
1387
1376
|
Data_Get_Struct(self, QUEUE_MANAGER, pqm);
|
1388
1377
|
|
@@ -1420,7 +1409,7 @@ VALUE QueueManager_execute(VALUE self, VALUE hash)
|
|
1420
1409
|
#else
|
1421
1410
|
rb_iterate (rb_each, hash, QueueManager_execute_each, (VALUE)pqm);
|
1422
1411
|
#endif
|
1423
|
-
if(pqm->trace_level) printf ("WMQ::QueueManager#execute() Queue Manager Handle:%ld\n", pqm->hcon);
|
1412
|
+
if(pqm->trace_level) printf ("WMQ::QueueManager#execute() Queue Manager Handle:%ld\n", (long)pqm->hcon);
|
1424
1413
|
|
1425
1414
|
pqm->mqExecute(
|
1426
1415
|
pqm->hcon, /* MQ connection handle */
|
@@ -1454,7 +1443,7 @@ VALUE QueueManager_execute(VALUE self, VALUE hash)
|
|
1454
1443
|
pqm->mqCountItems(pqm->reply_bag, MQHA_BAG_HANDLE, &numberOfBags, &pqm->comp_code, &pqm->reason_code);
|
1455
1444
|
CHECK_COMPLETION_CODE("Counting number of bags returned from the command server")
|
1456
1445
|
|
1457
|
-
if(pqm->trace_level > 1) printf("WMQ::QueueManager#execute() %ld bags returned\n", numberOfBags);
|
1446
|
+
if(pqm->trace_level > 1) printf("WMQ::QueueManager#execute() %ld bags returned\n", (long)numberOfBags);
|
1458
1447
|
array = rb_ary_new2(numberOfBags);
|
1459
1448
|
|
1460
1449
|
for ( bag_index=0; bag_index<numberOfBags; bag_index++) /* For each bag, extract the queue depth */
|
@@ -1467,7 +1456,7 @@ VALUE QueueManager_execute(VALUE self, VALUE hash)
|
|
1467
1456
|
pqm->mqCountItems(qAttrsBag, MQSEL_ALL_SELECTORS, &number_of_items, &pqm->comp_code, &pqm->reason_code);
|
1468
1457
|
CHECK_COMPLETION_CODE("Counting number of items in this bag")
|
1469
1458
|
|
1470
|
-
if(pqm->trace_level > 1) printf("WMQ::QueueManager#execute() Bag %
|
1459
|
+
if(pqm->trace_level > 1) printf("WMQ::QueueManager#execute() Bag %d contains %ld items\n", bag_index, (long)number_of_items);
|
1471
1460
|
|
1472
1461
|
for (items=0; items<number_of_items; items++) /* For each item, extract it's value */
|
1473
1462
|
{
|
@@ -1490,7 +1479,7 @@ VALUE QueueManager_execute(VALUE self, VALUE hash)
|
|
1490
1479
|
CHECK_COMPLETION_CODE("Inquiring Integer item")
|
1491
1480
|
|
1492
1481
|
if(pqm->trace_level > 1)
|
1493
|
-
printf("WMQ::QueueManager#execute() Item %
|
1482
|
+
printf("WMQ::QueueManager#execute() Item %d: Integer:%ld, selector:%ld\n", items, (long)qDepth, (long)selector);
|
1494
1483
|
|
1495
1484
|
rb_hash_aset(hash, ID2SYM(wmq_selector_id(selector)), LONG2NUM(qDepth));
|
1496
1485
|
break;
|
@@ -1499,8 +1488,8 @@ VALUE QueueManager_execute(VALUE self, VALUE hash)
|
|
1499
1488
|
pqm->mqInquireString(qAttrsBag, MQSEL_ALL_SELECTORS, items, WMQ_EXEC_STRING_INQ_BUFFER_SIZE-1, inquiry_buffer,
|
1500
1489
|
&size, NULL, &pqm->comp_code, &pqm->reason_code);
|
1501
1490
|
if(pqm->trace_level > 2)
|
1502
|
-
printf("WMQ::QueueManager#execute() mqInquireString buffer size: %
|
1503
|
-
WMQ_EXEC_STRING_INQ_BUFFER_SIZE,size);
|
1491
|
+
printf("WMQ::QueueManager#execute() mqInquireString buffer size: %d, string size:%ld\n",
|
1492
|
+
WMQ_EXEC_STRING_INQ_BUFFER_SIZE,(long)size);
|
1504
1493
|
CHECK_COMPLETION_CODE("Inquiring String item")
|
1505
1494
|
|
1506
1495
|
length = 0;
|
@@ -1519,8 +1508,8 @@ VALUE QueueManager_execute(VALUE self, VALUE hash)
|
|
1519
1508
|
if(pqm->trace_level > 1)
|
1520
1509
|
{
|
1521
1510
|
inquiry_buffer[length] = '\0';
|
1522
|
-
printf("WMQ::QueueManager#execute() Item %
|
1523
|
-
items, inquiry_buffer, selector);
|
1511
|
+
printf("WMQ::QueueManager#execute() Item %d: String:'%s', selector:%ld\n",
|
1512
|
+
items, inquiry_buffer, (long)selector);
|
1524
1513
|
}
|
1525
1514
|
break;
|
1526
1515
|
|
@@ -1529,7 +1518,7 @@ VALUE QueueManager_execute(VALUE self, VALUE hash)
|
|
1529
1518
|
break;
|
1530
1519
|
|
1531
1520
|
default:
|
1532
|
-
printf("Ignoring Unknown type:%ld\n", item_type);
|
1521
|
+
printf("Ignoring Unknown type:%ld\n", (long)item_type);
|
1533
1522
|
break;
|
1534
1523
|
}
|
1535
1524
|
}
|
data/tests/test.rb
CHANGED
metadata
CHANGED
@@ -1,53 +1,50 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.1
|
3
|
-
specification_version: 1
|
4
2
|
name: rubywmq
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-01-19 00:00:00 -05:00
|
8
|
-
summary: Ruby interface into WebSphere MQ (MQSeries)
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: rubywmq@gmail.com
|
12
|
-
homepage: http://rubywmq.rubyforge.org
|
13
|
-
rubyforge_project: rubywmq
|
14
|
-
description:
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.8.0
|
24
|
-
version:
|
4
|
+
version: 1.0.0
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Reid Morrison
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-12-07 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: rubywmq@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions:
|
21
|
+
- ext/extconf.rb
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
- LICENSE
|
31
25
|
files:
|
32
|
-
- examples/each_a.rb
|
33
|
-
- examples/each_b.rb
|
34
|
-
- examples/each_header.rb
|
35
|
-
- examples/files_to_q.rb
|
36
|
-
- examples/get_a.rb
|
37
|
-
- examples/get_client.rb
|
38
|
-
- examples/put1_a.rb
|
39
|
-
- examples/put1_b.rb
|
40
|
-
- examples/put1_c.rb
|
41
|
-
- examples/put_a.rb
|
42
26
|
- examples/put_b.rb
|
43
|
-
- examples/
|
44
|
-
- examples/
|
27
|
+
- examples/put1_b.rb
|
28
|
+
- examples/each_a.rb
|
45
29
|
- examples/put_rfh.rb
|
30
|
+
- examples/put_group_b.rb
|
46
31
|
- examples/put_rfh2_a.rb
|
47
|
-
- examples/
|
48
|
-
- examples/
|
32
|
+
- examples/put_dlh.rb
|
33
|
+
- examples/put_a.rb
|
49
34
|
- examples/request.rb
|
35
|
+
- examples/get_client.rb
|
50
36
|
- examples/server.rb
|
37
|
+
- examples/each_header.rb
|
38
|
+
- examples/put1_c.rb
|
39
|
+
- examples/put1_a.rb
|
40
|
+
- examples/put_rfh2_b.rb
|
41
|
+
- examples/each_b.rb
|
42
|
+
- examples/q_to_files.rb
|
43
|
+
- examples/put_xmit_q.rb
|
44
|
+
- examples/put_group_a.rb
|
45
|
+
- examples/get_a.rb
|
46
|
+
- examples/files_to_q.rb
|
47
|
+
- examples/put_dynamic_q.rb
|
51
48
|
- .document
|
52
49
|
- lib/wmq.rb
|
53
50
|
- ext/lib/wmq_temp.rb
|
@@ -70,18 +67,31 @@ files:
|
|
70
67
|
- examples/files_to_q.cfg
|
71
68
|
- README
|
72
69
|
- LICENSE
|
73
|
-
|
74
|
-
|
70
|
+
has_rdoc: true
|
71
|
+
homepage: http://rubywmq.rubyforge.org
|
72
|
+
post_install_message:
|
75
73
|
rdoc_options: []
|
76
74
|
|
77
|
-
|
78
|
-
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 1.8.0
|
82
|
+
version:
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: "0"
|
88
|
+
version:
|
84
89
|
requirements:
|
85
90
|
- WebSphere MQ, v5.3 or greater
|
86
|
-
|
87
|
-
|
91
|
+
rubyforge_project: rubywmq
|
92
|
+
rubygems_version: 1.1.1
|
93
|
+
signing_key:
|
94
|
+
specification_version: 2
|
95
|
+
summary: Ruby interface into WebSphere MQ (MQSeries)
|
96
|
+
test_files:
|
97
|
+
- tests/test.rb
|