qpid_proton 0.26.0 → 0.32.0
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.
- checksums.yaml +5 -5
- data/ext/cproton/cproton.c +1812 -4106
- data/lib/handler/messaging_adapter.rb +4 -2
- data/tests/{old-examples/lib/debugging.rb → collect_coverage.rb} +12 -5
- metadata +4 -18
- data/tests/old-examples/broker.rb +0 -200
- data/tests/old-examples/client.rb +0 -81
- data/tests/old-examples/direct_recv.rb +0 -64
- data/tests/old-examples/direct_send.rb +0 -63
- data/tests/old-examples/helloworld.rb +0 -72
- data/tests/old-examples/helloworld_direct.rb +0 -73
- data/tests/old-examples/lib/driver.rb +0 -68
- data/tests/old-examples/lib/qpid_examples.rb +0 -26
- data/tests/old-examples/lib/selectable.rb +0 -119
- data/tests/old-examples/lib/send_and_receive.rb +0 -89
- data/tests/old-examples/old_example_test.rb +0 -99
- data/tests/old-examples/server.rb +0 -75
- data/tests/old-examples/simple_recv.rb +0 -57
- data/tests/old-examples/simple_send.rb +0 -54
@@ -124,8 +124,10 @@ module Qpid::Proton
|
|
124
124
|
when Delivery::RELEASED then delegate(:on_tracker_release, t)
|
125
125
|
when Delivery::MODIFIED then delegate(:on_tracker_modify, t)
|
126
126
|
end
|
127
|
-
|
128
|
-
|
127
|
+
if t.settled?
|
128
|
+
delegate(:on_tracker_settle, t)
|
129
|
+
t.settle if t.sender.auto_settle
|
130
|
+
end
|
129
131
|
end
|
130
132
|
end
|
131
133
|
|
@@ -16,10 +16,17 @@
|
|
16
16
|
# under the License.
|
17
17
|
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
if ENV['COVERAGE']
|
20
|
+
require 'simplecov'
|
21
|
+
SimpleCov.start do
|
22
|
+
if ENV['TRAVIS']
|
23
|
+
require 'codecov'
|
24
|
+
formatter SimpleCov::Formatter::MultiFormatter.new([
|
25
|
+
SimpleCov::Formatter::HTMLFormatter,
|
26
|
+
SimpleCov::Formatter::Codecov,
|
27
|
+
])
|
28
|
+
end
|
29
|
+
coverage_dir ENV['COVERAGE_DIR'] or 'coverage'
|
30
|
+
track_files 'ruby/lib/**/*.rb'
|
23
31
|
end
|
24
|
-
|
25
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qpid_proton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darryl L. Pierce
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-09-02 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: |
|
15
15
|
Proton is a high performance, lightweight messaging library. It can be used in
|
@@ -91,21 +91,7 @@ files:
|
|
91
91
|
- lib/util/schedule.rb
|
92
92
|
- lib/util/version.rb
|
93
93
|
- lib/util/wrapper.rb
|
94
|
-
- tests/
|
95
|
-
- tests/old-examples/client.rb
|
96
|
-
- tests/old-examples/direct_recv.rb
|
97
|
-
- tests/old-examples/direct_send.rb
|
98
|
-
- tests/old-examples/helloworld.rb
|
99
|
-
- tests/old-examples/helloworld_direct.rb
|
100
|
-
- tests/old-examples/lib/debugging.rb
|
101
|
-
- tests/old-examples/lib/driver.rb
|
102
|
-
- tests/old-examples/lib/qpid_examples.rb
|
103
|
-
- tests/old-examples/lib/selectable.rb
|
104
|
-
- tests/old-examples/lib/send_and_receive.rb
|
105
|
-
- tests/old-examples/old_example_test.rb
|
106
|
-
- tests/old-examples/server.rb
|
107
|
-
- tests/old-examples/simple_recv.rb
|
108
|
-
- tests/old-examples/simple_send.rb
|
94
|
+
- tests/collect_coverage.rb
|
109
95
|
- tests/test_connection_driver.rb
|
110
96
|
- tests/test_container.rb
|
111
97
|
- tests/test_container_sasl.rb
|
@@ -137,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
123
|
version: '0'
|
138
124
|
requirements: []
|
139
125
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.7.6.2
|
141
127
|
signing_key:
|
142
128
|
specification_version: 4
|
143
129
|
summary: Ruby language bindings for the Qpid Proton messaging framework
|
@@ -1,200 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
-
# or more contributor license agreements. See the NOTICE file
|
3
|
-
# distributed with this work for additional information
|
4
|
-
# regarding copyright ownership. The ASF licenses this file
|
5
|
-
# to you under the Apache License, Version 2.0 (the
|
6
|
-
# "License"); you may not use this file except in compliance
|
7
|
-
# with the License. You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
17
|
-
|
18
|
-
|
19
|
-
require 'qpid_proton'
|
20
|
-
require 'optparse'
|
21
|
-
require 'pathname'
|
22
|
-
|
23
|
-
require_relative 'lib/debugging'
|
24
|
-
|
25
|
-
class Exchange
|
26
|
-
|
27
|
-
include Debugging
|
28
|
-
|
29
|
-
def initialize(dynamic = false)
|
30
|
-
@dynamic = dynamic
|
31
|
-
@queue = Queue.new
|
32
|
-
@consumers = []
|
33
|
-
end
|
34
|
-
|
35
|
-
def subscribe(consumer)
|
36
|
-
debug("subscribing #{consumer}") if $options[:debug]
|
37
|
-
@consumers << (consumer)
|
38
|
-
debug(" there are #{@consumers.size} consumers") if $options[:debug]
|
39
|
-
end
|
40
|
-
|
41
|
-
def unsubscribe(consumer)
|
42
|
-
debug("unsubscribing #{consumer}") if $options[:debug]
|
43
|
-
if @consumers.include?(consumer)
|
44
|
-
@consumers.delete(consumer)
|
45
|
-
else
|
46
|
-
debug(" consumer doesn't exist") if $options[:debug]
|
47
|
-
end
|
48
|
-
debug(" there are #{@consumers.size} consumers") if $options[:debug]
|
49
|
-
@consumers.empty? && (@dynamic || @queue.empty?)
|
50
|
-
end
|
51
|
-
|
52
|
-
def publish(message)
|
53
|
-
debug("queueing message: #{message.body}") if $options[:debug]
|
54
|
-
@queue << message
|
55
|
-
self.dispatch
|
56
|
-
end
|
57
|
-
|
58
|
-
def dispatch(consumer = nil)
|
59
|
-
debug("dispatching: consumer=#{consumer}") if $options[:debug]
|
60
|
-
if consumer
|
61
|
-
c = [consumer]
|
62
|
-
else
|
63
|
-
c = @consumers
|
64
|
-
end
|
65
|
-
|
66
|
-
while self.deliver_to(c) do
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def deliver_to(consumers)
|
71
|
-
debug("delivering to #{consumers.size} consumer(s)") if $options[:debug]
|
72
|
-
result = false
|
73
|
-
consumers.each do |consumer|
|
74
|
-
debug(" current consumer=#{consumer} credit=#{consumer.credit}") if $options[:debug]
|
75
|
-
if consumer.credit > 0 && !@queue.empty?
|
76
|
-
consumer.send(@queue.pop(true))
|
77
|
-
result = true
|
78
|
-
end
|
79
|
-
end
|
80
|
-
return result
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
class Broker < Qpid::Proton::Handler::MessagingHandler
|
86
|
-
|
87
|
-
include Debugging
|
88
|
-
|
89
|
-
def initialize(url)
|
90
|
-
super()
|
91
|
-
@url = url
|
92
|
-
@queues = {}
|
93
|
-
end
|
94
|
-
|
95
|
-
def on_start(event)
|
96
|
-
debug("on_start event") if $options[:debug]
|
97
|
-
@acceptor = event.container.listen(@url)
|
98
|
-
print "Listening on #{@url}\n"
|
99
|
-
STDOUT.flush
|
100
|
-
end
|
101
|
-
|
102
|
-
def queue(address)
|
103
|
-
debug("fetching queue for #{address}: (there are #{@queues.size} queues)") if $options[:debug]
|
104
|
-
unless @queues.has_key?(address)
|
105
|
-
debug(" creating new queue") if $options[:debug]
|
106
|
-
@queues[address] = Exchange.new
|
107
|
-
else
|
108
|
-
debug(" using existing queue") if $options[:debug]
|
109
|
-
end
|
110
|
-
result = @queues[address]
|
111
|
-
debug(" returning #{result}") if $options[:debug]
|
112
|
-
return result
|
113
|
-
end
|
114
|
-
|
115
|
-
def on_link_opening(event)
|
116
|
-
debug("processing on_link_opening") if $options[:debug]
|
117
|
-
debug("link is#{event.link.sender? ? '' : ' not'} a sender") if $options[:debug]
|
118
|
-
if event.link.sender?
|
119
|
-
if event.link.remote_source.dynamic?
|
120
|
-
address = SecureRandom.uuid
|
121
|
-
event.link.source.address = address
|
122
|
-
q = Exchange.new(true)
|
123
|
-
@queues[address] = q
|
124
|
-
q.subscribe(event.link)
|
125
|
-
elsif event.link.remote_source.address
|
126
|
-
event.link.source.address = event.link.remote_source.address
|
127
|
-
self.queue(event.link.source.address).subscribe(event.link)
|
128
|
-
end
|
129
|
-
elsif event.link.remote_target.address
|
130
|
-
event.link.target.address = event.link.remote_target.address
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
def unsubscribe(link)
|
135
|
-
debug("unsubscribing #{link.address}") if $options[:debug]
|
136
|
-
if @queues.has_key?(link.source.address)
|
137
|
-
if @queues[link.source.address].unsubscribe(link)
|
138
|
-
@queues.delete(link.source.address)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def on_link_closing(event)
|
144
|
-
self.unsubscribe(event.link) if event.link.sender?
|
145
|
-
end
|
146
|
-
|
147
|
-
def on_connection_closing(event)
|
148
|
-
self.remove_stale_consumers(event.connection)
|
149
|
-
end
|
150
|
-
|
151
|
-
def on_disconnected(event)
|
152
|
-
self.remove_stale_consumers(event.connection)
|
153
|
-
end
|
154
|
-
|
155
|
-
def remove_stale_consumers(connection)
|
156
|
-
l = connection.link_head(Qpid::Proton::Endpoint::REMOTE_ACTIVE)
|
157
|
-
while !l.nil?
|
158
|
-
self.unsubscribe(l) if l.sender?
|
159
|
-
l = l.next(Qpid::Proton::Endpoint::REMOTE_ACTIVE)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
def on_sendable(event)
|
164
|
-
debug("on_sendable event") if $options[:debug]
|
165
|
-
q = self.queue(event.link.source.address)
|
166
|
-
debug(" dispatching #{event.message} to #{q}") if $options[:debug]
|
167
|
-
q.dispatch(event.link)
|
168
|
-
end
|
169
|
-
|
170
|
-
def on_message(event)
|
171
|
-
debug("on_message event") if $options[:debug]
|
172
|
-
q = self.queue(event.link.target.address)
|
173
|
-
debug(" dispatching #{event.message} to #{q}") if $options[:debug]
|
174
|
-
q.publish(event.message)
|
175
|
-
end
|
176
|
-
|
177
|
-
end
|
178
|
-
|
179
|
-
$options = {
|
180
|
-
:address => "localhost:5672",
|
181
|
-
:debug => false
|
182
|
-
}
|
183
|
-
|
184
|
-
OptionParser.new do |opts|
|
185
|
-
opts.banner = "Usage: #{Pathname.new(__FILE__).basename} [$options]"
|
186
|
-
|
187
|
-
opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{$options[:address]}).") do |address|
|
188
|
-
$options[:address] = address
|
189
|
-
end
|
190
|
-
|
191
|
-
opts.on("-d", "--debug", "Enable debugging output (def. #{$options[:debug]})") do
|
192
|
-
$options[:debug] = true
|
193
|
-
end
|
194
|
-
|
195
|
-
end.parse!
|
196
|
-
|
197
|
-
begin
|
198
|
-
Qpid::Proton::Reactor::Container.new(Broker.new($options[:address])).run
|
199
|
-
rescue Interrupt
|
200
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
-
# or more contributor license agreements. See the NOTICE file
|
3
|
-
# distributed with this work for additional information
|
4
|
-
# regarding copyright ownership. The ASF licenses this file
|
5
|
-
# to you under the Apache License, Version 2.0 (the
|
6
|
-
# "License"); you may not use this file except in compliance
|
7
|
-
# with the License. You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
17
|
-
|
18
|
-
|
19
|
-
require 'qpid_proton'
|
20
|
-
require 'optparse'
|
21
|
-
|
22
|
-
class Client < Qpid::Proton::Handler::MessagingHandler
|
23
|
-
|
24
|
-
def initialize(url, requests)
|
25
|
-
super()
|
26
|
-
@url = url
|
27
|
-
@requests = requests
|
28
|
-
end
|
29
|
-
|
30
|
-
def on_start(event)
|
31
|
-
@sender = event.container.create_sender(@url)
|
32
|
-
@receiver = event.container.create_receiver(@sender.connection, :dynamic => true)
|
33
|
-
end
|
34
|
-
|
35
|
-
def next_request
|
36
|
-
if @receiver.remote_source.address
|
37
|
-
req = Qpid::Proton::Message.new
|
38
|
-
req.reply_to = @receiver.remote_source.address
|
39
|
-
req.body = @requests.first
|
40
|
-
puts "-> #{req.body}"
|
41
|
-
@sender.send(req)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def on_link_opened(event)
|
46
|
-
if event.receiver == @receiver
|
47
|
-
next_request
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def on_message(event)
|
52
|
-
puts "<- #{event.message.body}"
|
53
|
-
@requests.delete_at(0)
|
54
|
-
if !@requests.empty?
|
55
|
-
next_request
|
56
|
-
else
|
57
|
-
event.connection.close
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def on_transport_error(event)
|
62
|
-
raise "Connection error: #{event.transport.condition}"
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
REQUESTS = ["Twas brillig, and the slithy toves",
|
68
|
-
"Did gire and gymble in the wabe.",
|
69
|
-
"All mimsy were the borogroves,",
|
70
|
-
"And the mome raths outgrabe."]
|
71
|
-
|
72
|
-
options = {
|
73
|
-
:address => "localhost:5672/examples",
|
74
|
-
}
|
75
|
-
|
76
|
-
OptionParser.new do |opts|
|
77
|
-
opts.banner = "Usage: client.rb [options]"
|
78
|
-
opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") { |address| options[:address] = address }
|
79
|
-
end.parse!
|
80
|
-
|
81
|
-
Qpid::Proton::Reactor::Container.new(Client.new(options[:address], REQUESTS)).run
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
-
# or more contributor license agreements. See the NOTICE file
|
3
|
-
# distributed with this work for additional information
|
4
|
-
# regarding copyright ownership. The ASF licenses this file
|
5
|
-
# to you under the Apache License, Version 2.0 (the
|
6
|
-
# "License"); you may not use this file except in compliance
|
7
|
-
# with the License. You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
17
|
-
|
18
|
-
|
19
|
-
require 'qpid_proton'
|
20
|
-
require 'optparse'
|
21
|
-
|
22
|
-
require_relative 'lib/send_and_receive'
|
23
|
-
|
24
|
-
class DirectReceive < ExampleReceive
|
25
|
-
|
26
|
-
def initialize(url, expected)
|
27
|
-
super
|
28
|
-
end
|
29
|
-
|
30
|
-
def on_start(event)
|
31
|
-
@acceptor = event.container.listen(self.url)
|
32
|
-
puts "Listening"; STDOUT.flush
|
33
|
-
end
|
34
|
-
|
35
|
-
def on_connection_opening(event)
|
36
|
-
@acceptor.close
|
37
|
-
end
|
38
|
-
|
39
|
-
def on_message(event)
|
40
|
-
super(event)
|
41
|
-
@acceptor.close if self.finished?
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
options = {
|
47
|
-
:address => "localhost:5672/examples",
|
48
|
-
:messages => 10,
|
49
|
-
}
|
50
|
-
|
51
|
-
OptionParser.new do |opts|
|
52
|
-
opts.banner = "Usage: simple_send.rb [options]"
|
53
|
-
|
54
|
-
opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
|
55
|
-
options[:address] = address
|
56
|
-
end
|
57
|
-
|
58
|
-
opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
|
59
|
-
OptionParser::DecimalInteger) do |messages|
|
60
|
-
options[:messages] = messages
|
61
|
-
end
|
62
|
-
end.parse!
|
63
|
-
|
64
|
-
Qpid::Proton::Reactor::Container.new(DirectReceive.new(options[:address], options[:messages])).run
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
-
# or more contributor license agreements. See the NOTICE file
|
3
|
-
# distributed with this work for additional information
|
4
|
-
# regarding copyright ownership. The ASF licenses this file
|
5
|
-
# to you under the Apache License, Version 2.0 (the
|
6
|
-
# "License"); you may not use this file except in compliance
|
7
|
-
# with the License. You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
17
|
-
|
18
|
-
|
19
|
-
require 'qpid_proton'
|
20
|
-
require 'optparse'
|
21
|
-
|
22
|
-
require_relative 'lib/send_and_receive'
|
23
|
-
|
24
|
-
options = {
|
25
|
-
:address => "localhost:5672/examples",
|
26
|
-
:messages => 10,
|
27
|
-
}
|
28
|
-
|
29
|
-
class SimpleSend < ExampleSend
|
30
|
-
|
31
|
-
def initialize(url, messages)
|
32
|
-
super(url, messages)
|
33
|
-
end
|
34
|
-
|
35
|
-
def on_start(event)
|
36
|
-
@acceptor = event.container.listen(url)
|
37
|
-
puts "Listening"; STDOUT.flush
|
38
|
-
end
|
39
|
-
|
40
|
-
def on_connection_opening(event)
|
41
|
-
@acceptor.close
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
OptionParser.new do |opts|
|
46
|
-
opts.banner = "Usage: simple_send.rb [options]"
|
47
|
-
|
48
|
-
opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
|
49
|
-
options[:address] = address
|
50
|
-
end
|
51
|
-
|
52
|
-
opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
|
53
|
-
OptionParser::DecimalInteger) do |messages|
|
54
|
-
options[:messages] = messages
|
55
|
-
end
|
56
|
-
end.parse!
|
57
|
-
|
58
|
-
begin
|
59
|
-
Qpid::Proton::Reactor::Container.new(SimpleSend.new(options[:address], options[:messages]), {:container_id=> "direct_send"}).run
|
60
|
-
|
61
|
-
rescue Interrupt => error
|
62
|
-
puts "ERROR: #{error}"
|
63
|
-
end
|