rubywmq 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
- data/examples/put1_a.rb +25 -25
- data/examples/q_to_files.rb +48 -48
- data/ext/build.sh +0 -0
- data/ext/decode_rfh.c +348 -348
- data/ext/decode_rfh.h +45 -45
- data/ext/extconf.rb +44 -44
- data/ext/generate/generate_structs.rb +97 -97
- data/ext/generate/wmq_structs.erb +1 -18
- data/ext/wmq.c +93 -93
- data/ext/wmq.h +367 -350
- data/ext/wmq_message.c +671 -682
- data/ext/wmq_mq_load.c +217 -217
- data/ext/wmq_queue.c +1411 -1411
- data/ext/wmq_queue_manager.c +1570 -1581
- data/tests/test.rb +328 -300
- metadata +46 -47
data/README
CHANGED
data/examples/put1_a.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
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 : put1() : Put a single message to a queue
|
19
|
-
#
|
20
|
-
require 'rubygems'
|
21
|
-
require 'wmq/wmq'
|
22
|
-
|
23
|
-
WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
|
24
|
-
qmgr.put(:q_name=>'TEST.QUEUE', :data => 'Hello World')
|
25
|
-
end
|
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 : put1() : Put a single message to a queue
|
19
|
+
#
|
20
|
+
require 'rubygems'
|
21
|
+
require 'wmq/wmq'
|
22
|
+
|
23
|
+
WMQ::QueueManager.connect(:q_mgr_name=>'REID') do |qmgr|
|
24
|
+
qmgr.put(:q_name=>'TEST.QUEUE', :data => 'Hello World')
|
25
|
+
end
|
data/examples/q_to_files.rb
CHANGED
@@ -1,48 +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
|
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/ext/build.sh
CHANGED
File without changes
|