rmq 0.0.6 → 0.0.7
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/lib/rmq.rb +13 -13
- data/lib/rmq/constants.rb +1497 -1497
- data/lib/rmq/exceptions.rb +21 -21
- data/lib/rmq/get_message_options.rb +55 -55
- data/lib/rmq/message.rb +13 -13
- data/lib/rmq/message_descriptor.rb +46 -46
- data/lib/rmq/mqclient.rb +333 -324
- data/lib/rmq/object_descriptor.rb +41 -41
- data/lib/rmq/put_message_options.rb +31 -31
- data/lib/rmq/queue.rb +54 -54
- data/lib/rmq/queue_manager.rb +107 -107
- data/lib/rmq/version.rb +2 -2
- data/spec/rmq/queue_manager_spec.rb +59 -63
- data/spec/rmq/queue_spec.rb +47 -47
- data/spec/spec_helper.rb +20 -20
- metadata +15 -15
data/lib/rmq/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module RMQ
|
2
|
-
VERSION = "0.0.
|
1
|
+
module RMQ
|
2
|
+
VERSION = "0.0.7"
|
3
3
|
end
|
@@ -1,63 +1,59 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe RMQ::QueueManager do
|
4
|
-
SAMPLE_QUEUE = SpecHelper::DATA[:sample_queue]
|
5
|
-
|
6
|
-
after(:each) do
|
7
|
-
begin
|
8
|
-
@qm.delete_queue(SAMPLE_QUEUE) if !@qm.find_queue(SAMPLE_QUEUE).nil?
|
9
|
-
rescue
|
10
|
-
puts "Cannot delete #{SAMPLE_QUEUE}"
|
11
|
-
end
|
12
|
-
@qm.disconnect if !@qm.nil?
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
@qm
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
@qm
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
@qm
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
@qm
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
@qm
|
56
|
-
@qm.
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
@qm.find_queue(SAMPLE_QUEUE).should be_nil
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RMQ::QueueManager do
|
4
|
+
SAMPLE_QUEUE = SpecHelper::DATA[:sample_queue]
|
5
|
+
|
6
|
+
after(:each) do
|
7
|
+
begin
|
8
|
+
@qm.delete_queue(SAMPLE_QUEUE) if !@qm.find_queue(SAMPLE_QUEUE).nil?
|
9
|
+
rescue
|
10
|
+
puts "Cannot delete #{SAMPLE_QUEUE}"
|
11
|
+
end
|
12
|
+
@qm.disconnect if !@qm.nil?
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should connect/disconnect to/from local queue manager' do
|
16
|
+
@qm = RMQ::QueueManager::connect(SpecHelper::DATA[:queue_manager])
|
17
|
+
@qm.should_not be_nil
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should raise an exception for a wrong queue manager name" do
|
21
|
+
lambda { RMQ::QueueManager::connect("INVALID_NAME") }.should raise_error(RMQ::RMQException)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should warn about missing MQSERVER environment variable" do
|
25
|
+
ENV['MQSERVER'] = ""
|
26
|
+
|
27
|
+
lambda { RMQ::QueueManager::connect(SpecHelper::DATA[:queue_manager]) }.should raise_error(RuntimeError)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should create a new queue" do
|
31
|
+
@qm = RMQ::QueueManager::connect(SpecHelper::DATA[:queue_manager])
|
32
|
+
queue = @qm.create_queue(SAMPLE_QUEUE)
|
33
|
+
queue.should_not be_nil
|
34
|
+
|
35
|
+
@qm.find_queue(SAMPLE_QUEUE).should_not be_nil
|
36
|
+
|
37
|
+
@qm.delete_queue(SAMPLE_QUEUE)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should find an existing queue" do
|
41
|
+
@qm = RMQ::QueueManager::connect(SpecHelper::DATA[:queue_manager])
|
42
|
+
@qm.find_queue("SYSTEM.ADMIN.COMMAND.QUEUE").should_not be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should not find a non-existing queue" do
|
46
|
+
@qm = RMQ::QueueManager::connect(SpecHelper::DATA[:queue_manager])
|
47
|
+
@qm.find_queue("DOES_NOT_EXIST").should be_nil
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should delete a queue" do
|
51
|
+
@qm = RMQ::QueueManager::connect(SpecHelper::DATA[:queue_manager])
|
52
|
+
@qm.create_queue(SAMPLE_QUEUE)
|
53
|
+
@qm.find_queue(SAMPLE_QUEUE).should_not be_nil
|
54
|
+
|
55
|
+
@qm.delete_queue(SAMPLE_QUEUE)
|
56
|
+
@qm.find_queue(SAMPLE_QUEUE).should be_nil
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
data/spec/rmq/queue_spec.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe RMQ::Queue do
|
4
|
-
SAMPLE_QUEUE = SpecHelper::DATA[:sample_queue]
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@qm = RMQ::QueueManager::connect(SpecHelper::DATA[:queue_manager])
|
8
|
-
|
9
|
-
@qm.delete_queue(SAMPLE_QUEUE) unless @qm.find_queue(SAMPLE_QUEUE).nil?
|
10
|
-
@queue = @qm.create_queue(SAMPLE_QUEUE)
|
11
|
-
end
|
12
|
-
|
13
|
-
after(:each) do
|
14
|
-
begin
|
15
|
-
@qm.delete_queue(SAMPLE_QUEUE)
|
16
|
-
rescue
|
17
|
-
puts "Cannot delete #{SAMPLE_QUEUE}"
|
18
|
-
end
|
19
|
-
@qm.disconnect if !@qm.nil?
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should put a message on a queue" do
|
23
|
-
@queue.put_message("sample message")
|
24
|
-
@queue.depth.should == 1
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should read a message from a queue" do
|
28
|
-
@queue.put_message("I want to read this back")
|
29
|
-
@queue.get_message_payload.should == "I want to read this back"
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should put a message on a queue and use a reply queue name" do
|
33
|
-
@queue.put_message("I want to read this back", "REPLY_QUEUE")
|
34
|
-
message = @queue.get_message
|
35
|
-
message.should_not be_nil
|
36
|
-
message.reply_queue_name.should == "REPLY_QUEUE"
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should time out waiting for a message" do
|
40
|
-
lambda { @queue.get_message(2) }.should raise_error(RMQ::RMQTimeOutError)
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should time out waiting for a message and not return any payload" do
|
44
|
-
lambda { @queue.get_message_payload(2) }.should raise_error(RMQ::RMQTimeOutError)
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RMQ::Queue do
|
4
|
+
SAMPLE_QUEUE = SpecHelper::DATA[:sample_queue]
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@qm = RMQ::QueueManager::connect(SpecHelper::DATA[:queue_manager])
|
8
|
+
|
9
|
+
@qm.delete_queue(SAMPLE_QUEUE) unless @qm.find_queue(SAMPLE_QUEUE).nil?
|
10
|
+
@queue = @qm.create_queue(SAMPLE_QUEUE)
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:each) do
|
14
|
+
begin
|
15
|
+
@qm.delete_queue(SAMPLE_QUEUE)
|
16
|
+
rescue
|
17
|
+
puts "Cannot delete #{SAMPLE_QUEUE}"
|
18
|
+
end
|
19
|
+
@qm.disconnect if !@qm.nil?
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should put a message on a queue" do
|
23
|
+
@queue.put_message("sample message")
|
24
|
+
@queue.depth.should == 1
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should read a message from a queue" do
|
28
|
+
@queue.put_message("I want to read this back")
|
29
|
+
@queue.get_message_payload.should == "I want to read this back"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should put a message on a queue and use a reply queue name" do
|
33
|
+
@queue.put_message("I want to read this back", "REPLY_QUEUE")
|
34
|
+
message = @queue.get_message
|
35
|
+
message.should_not be_nil
|
36
|
+
message.reply_queue_name.should == "REPLY_QUEUE"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should time out waiting for a message" do
|
40
|
+
lambda { @queue.get_message(2) }.should raise_error(RMQ::RMQTimeOutError)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should time out waiting for a message and not return any payload" do
|
44
|
+
lambda { @queue.get_message_payload(2) }.should raise_error(RMQ::RMQTimeOutError)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'rmq'
|
3
|
-
|
4
|
-
MQSERVER = "SYSTEM.DEF.SVRCONN/TCP/127.0.0.1(1414)"
|
5
|
-
|
6
|
-
module SpecHelper
|
7
|
-
DATA = {
|
8
|
-
:queue_manager => "BKR_QMGR",
|
9
|
-
:sample_queue => "RMQ.SAMPLE"
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
RSpec.configure do |config|
|
14
|
-
config.color_enabled = true
|
15
|
-
config.formatter = 'documentation'
|
16
|
-
|
17
|
-
config.before(:each) do
|
18
|
-
ENV['MQSERVER'] = MQSERVER
|
19
|
-
end
|
20
|
-
end
|
1
|
+
require 'rspec'
|
2
|
+
require 'rmq'
|
3
|
+
|
4
|
+
MQSERVER = "SYSTEM.DEF.SVRCONN/TCP/127.0.0.1(1414)"
|
5
|
+
|
6
|
+
module SpecHelper
|
7
|
+
DATA = {
|
8
|
+
:queue_manager => "BKR_QMGR",
|
9
|
+
:sample_queue => "RMQ.SAMPLE"
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.color_enabled = true
|
15
|
+
config.formatter = 'documentation'
|
16
|
+
|
17
|
+
config.before(:each) do
|
18
|
+
ENV['MQSERVER'] = MQSERVER
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70046720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.7'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70046720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: ffi
|
27
|
-
requirement: &
|
27
|
+
requirement: &70045870 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,27 +32,27 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70045870
|
36
36
|
description: Ruby wrapper around MQ series client library
|
37
37
|
email: sns@caimito.net
|
38
38
|
executables: []
|
39
39
|
extensions: []
|
40
40
|
extra_rdoc_files: []
|
41
41
|
files:
|
42
|
-
- lib/rmq
|
42
|
+
- lib/rmq.rb
|
43
|
+
- lib/rmq/version.rb
|
43
44
|
- lib/rmq/exceptions.rb
|
44
|
-
- lib/rmq/get_message_options.rb
|
45
45
|
- lib/rmq/message.rb
|
46
|
-
- lib/rmq/message_descriptor.rb
|
47
|
-
- lib/rmq/mqclient.rb
|
48
46
|
- lib/rmq/object_descriptor.rb
|
49
47
|
- lib/rmq/put_message_options.rb
|
50
|
-
- lib/rmq/queue.rb
|
51
48
|
- lib/rmq/queue_manager.rb
|
52
|
-
- lib/rmq/
|
53
|
-
- lib/rmq.rb
|
54
|
-
-
|
49
|
+
- lib/rmq/get_message_options.rb
|
50
|
+
- lib/rmq/mqclient.rb
|
51
|
+
- lib/rmq/queue.rb
|
52
|
+
- lib/rmq/message_descriptor.rb
|
53
|
+
- lib/rmq/constants.rb
|
55
54
|
- spec/rmq/queue_spec.rb
|
55
|
+
- spec/rmq/queue_manager_spec.rb
|
56
56
|
- spec/spec_helper.rb
|
57
57
|
homepage: http://rubygems.org/gems/rmq
|
58
58
|
licenses: []
|
@@ -74,11 +74,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
76
|
rubyforge_project:
|
77
|
-
rubygems_version: 1.8.
|
77
|
+
rubygems_version: 1.8.17
|
78
78
|
signing_key:
|
79
79
|
specification_version: 3
|
80
80
|
summary: Ruby MQ client wrapper
|
81
81
|
test_files:
|
82
|
-
- spec/rmq/queue_manager_spec.rb
|
83
82
|
- spec/rmq/queue_spec.rb
|
83
|
+
- spec/rmq/queue_manager_spec.rb
|
84
84
|
- spec/spec_helper.rb
|