qpid_proton 0.18.1 → 0.19.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 +4 -4
- data/ext/cproton/cproton.c +863 -75
- data/lib/codec/data.rb +589 -815
- data/lib/codec/mapping.rb +142 -126
- data/lib/core/condition.rb +89 -0
- data/lib/core/connection.rb +188 -228
- data/lib/core/connection_driver.rb +202 -0
- data/lib/core/container.rb +366 -0
- data/lib/core/delivery.rb +76 -251
- data/lib/core/disposition.rb +21 -35
- data/lib/core/endpoint.rb +21 -53
- data/lib/core/event.rb +156 -0
- data/lib/core/exceptions.rb +109 -106
- data/lib/core/link.rb +24 -49
- data/lib/core/listener.rb +82 -0
- data/lib/core/message.rb +59 -155
- data/lib/core/messaging_handler.rb +190 -0
- data/lib/core/receiver.rb +38 -7
- data/lib/core/sasl.rb +43 -46
- data/lib/core/sender.rb +55 -32
- data/lib/core/session.rb +58 -58
- data/lib/core/ssl.rb +5 -13
- data/lib/core/ssl_details.rb +1 -2
- data/lib/core/ssl_domain.rb +5 -8
- data/lib/core/terminus.rb +62 -30
- data/lib/core/tracker.rb +45 -0
- data/lib/core/transfer.rb +121 -0
- data/lib/core/transport.rb +62 -97
- data/lib/core/uri.rb +73 -0
- data/lib/core/url.rb +11 -7
- data/lib/handler/adapter.rb +78 -0
- data/lib/handler/messaging_adapter.rb +127 -0
- data/lib/handler/messaging_handler.rb +128 -178
- data/lib/handler/reactor_messaging_adapter.rb +158 -0
- data/lib/messenger/messenger.rb +9 -8
- data/lib/messenger/subscription.rb +1 -2
- data/lib/messenger/tracker.rb +1 -2
- data/lib/messenger/tracker_status.rb +1 -2
- data/lib/qpid_proton.rb +36 -66
- data/lib/reactor/container.rb +40 -234
- data/lib/types/array.rb +73 -130
- data/lib/types/described.rb +2 -44
- data/lib/types/hash.rb +19 -56
- data/lib/types/strings.rb +1 -2
- data/lib/types/type.rb +68 -0
- data/lib/util/{handler.rb → deprecation.rb} +22 -15
- data/lib/util/error_handler.rb +4 -25
- data/lib/util/timeout.rb +1 -2
- data/lib/util/version.rb +1 -2
- data/lib/util/wrapper.rb +58 -38
- metadata +16 -33
- data/lib/core/base_handler.rb +0 -31
- data/lib/core/selectable.rb +0 -130
- data/lib/event/collector.rb +0 -148
- data/lib/event/event.rb +0 -318
- data/lib/event/event_base.rb +0 -91
- data/lib/event/event_type.rb +0 -71
- data/lib/handler/acking.rb +0 -70
- data/lib/handler/c_adaptor.rb +0 -47
- data/lib/handler/c_flow_controller.rb +0 -33
- data/lib/handler/endpoint_state_handler.rb +0 -217
- data/lib/handler/incoming_message_handler.rb +0 -74
- data/lib/handler/outgoing_message_handler.rb +0 -100
- data/lib/handler/wrapped_handler.rb +0 -76
- data/lib/reactor/acceptor.rb +0 -41
- data/lib/reactor/backoff.rb +0 -41
- data/lib/reactor/connector.rb +0 -115
- data/lib/reactor/global_overrides.rb +0 -44
- data/lib/reactor/link_option.rb +0 -90
- data/lib/reactor/reactor.rb +0 -196
- data/lib/reactor/session_per_connection.rb +0 -45
- data/lib/reactor/ssl_config.rb +0 -41
- data/lib/reactor/task.rb +0 -39
- data/lib/reactor/urls.rb +0 -45
- data/lib/util/class_wrapper.rb +0 -54
- data/lib/util/condition.rb +0 -47
- data/lib/util/constants.rb +0 -85
- data/lib/util/engine.rb +0 -82
- data/lib/util/reactor.rb +0 -32
- data/lib/util/swig_helper.rb +0 -114
- data/lib/util/uuid.rb +0 -32
data/lib/core/url.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# Licensed to the Apache Software Foundation (ASF) under one
|
3
2
|
# or more contributor license agreements. See the NOTICE file
|
4
3
|
# distributed with this work for additional information
|
@@ -15,24 +14,25 @@
|
|
15
14
|
# KIND, either express or implied. See the License for the
|
16
15
|
# specific language governing permissions and limitations
|
17
16
|
# under the License.
|
18
|
-
|
17
|
+
|
19
18
|
|
20
19
|
module Qpid::Proton
|
21
20
|
|
21
|
+
# @deprecated use {URI} or {String}
|
22
22
|
class URL
|
23
|
+
include Util::Deprecation
|
23
24
|
|
24
25
|
attr_reader :scheme
|
25
26
|
attr_reader :username
|
27
|
+
alias user username
|
26
28
|
attr_reader :password
|
27
29
|
attr_reader :host
|
28
|
-
attr_reader :port
|
29
30
|
attr_reader :path
|
30
31
|
|
31
32
|
# Parse a string, return a new URL
|
32
33
|
# @param url [#to_s] the URL string
|
33
|
-
def initialize(url = nil
|
34
|
-
|
35
|
-
|
34
|
+
def initialize(url = nil)
|
35
|
+
deprecated self.class, 'URI or String'
|
36
36
|
if url
|
37
37
|
@url = Cproton.pn_url_parse(url.to_s)
|
38
38
|
if @url.nil?
|
@@ -62,14 +62,18 @@ module Qpid::Proton
|
|
62
62
|
Cproton.pn_url_get_port(@url).to_i
|
63
63
|
end
|
64
64
|
|
65
|
+
# @return [String] Convert to string
|
65
66
|
def to_s
|
66
67
|
"#{@scheme}://#{@username.nil? ? '' : @username}#{@password.nil? ? '' : '@' + @password + ':'}#{@host}:#{@port}/#{@path}"
|
67
68
|
end
|
68
69
|
|
70
|
+
# @return [String] Allow implicit conversion by {String#try_convert}
|
71
|
+
alias to_str to_s
|
72
|
+
|
69
73
|
private
|
70
74
|
|
71
75
|
def defaults
|
72
|
-
@scheme = @scheme || "
|
76
|
+
@scheme = @scheme || "amqp"
|
73
77
|
@host = @host || "0.0.0.0"
|
74
78
|
@port = @port || 5672
|
75
79
|
end
|
@@ -0,0 +1,78 @@
|
|
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
|
+
# @private
|
20
|
+
module Qpid::Proton
|
21
|
+
module Handler
|
22
|
+
|
23
|
+
def self.handler_method?(method) /^on_/ =~ name; end
|
24
|
+
|
25
|
+
# Handler for an array of handlers of uniform type, with non-conflicting options
|
26
|
+
class ArrayHandler
|
27
|
+
|
28
|
+
def initialize(handlers)
|
29
|
+
raise "empty handler array" if handlers.empty?
|
30
|
+
adapters = (handlers.map { |h| Adapter.adapter(h) }).uniq
|
31
|
+
raise "handler array not uniform, adapters requested: #{adapters}" if adapters.size > 1
|
32
|
+
@proton_adapter_class = adapters[0]
|
33
|
+
@methods = Set.new
|
34
|
+
handlers.each do |h|
|
35
|
+
@methods.merge(h.methods.select { |m| handler_method? m }) # Collect handler methods
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
attr_reader :options, :proton_adapter_class
|
40
|
+
|
41
|
+
def method_missing(name, *args)
|
42
|
+
if respond_to_missing?(name)
|
43
|
+
@adapters.each { |a| a.__send__(name, *args) if a.respond_to? name}
|
44
|
+
else
|
45
|
+
super
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def respond_to_missing?(name, private=false); @methods.include?(name); end
|
50
|
+
def respond_to?(name, all=false) super || respond_to_missing?(name); end # For ruby < 1.9.2
|
51
|
+
end
|
52
|
+
|
53
|
+
# Base adapter for raw proton events
|
54
|
+
class Adapter
|
55
|
+
def initialize(h) @handler = h; end
|
56
|
+
|
57
|
+
# Create and return an adapter for handler, or return h if it does not need adapting.
|
58
|
+
def self.adapt(handler)
|
59
|
+
return unless handler
|
60
|
+
a = Array(handler)
|
61
|
+
h = (a.size == 1) ? a[0] : ArrayHandler.new(a)
|
62
|
+
ac = adapter(h)
|
63
|
+
ac ? ac.new(h) : h
|
64
|
+
end
|
65
|
+
|
66
|
+
# Adapter class if requested by handler, else default to MessagingHandler
|
67
|
+
def self.adapter(handler)
|
68
|
+
handler.respond_to?(:proton_adapter_class) ? handler.proton_adapter_class : MessagingAdapter
|
69
|
+
end
|
70
|
+
|
71
|
+
def proton_adapter_class() nil; end # Adapters don't need adapting
|
72
|
+
|
73
|
+
def forward(method, *args)
|
74
|
+
(@handler.__send__(method, *args); true) if @handler.respond_to? method
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,127 @@
|
|
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
|
+
# @private
|
20
|
+
module Qpid::Proton
|
21
|
+
module Handler
|
22
|
+
|
23
|
+
# Adapt raw proton events to {MessagingHandler} events.
|
24
|
+
class MessagingAdapter < Adapter
|
25
|
+
|
26
|
+
def delegate(method, *args)
|
27
|
+
forward(method, *args) or forward(:on_unhandled, method, *args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def delegate_error(method, context)
|
31
|
+
unless forward(method, context) || forward(:on_error, context.condition)
|
32
|
+
forward(:on_unhandled, method, context)
|
33
|
+
# Close the whole connection on an un-handled error
|
34
|
+
context.connection.close(context.condition)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def on_container_start(container) delegate(:on_container_start, container); end
|
39
|
+
def on_container_stop(container) delegate(:on_container_stop, container); end
|
40
|
+
|
41
|
+
# Define repetative on_xxx_open/close methods for each endpoint type
|
42
|
+
def self.open_close(endpoint)
|
43
|
+
Module.new do
|
44
|
+
define_method(:"on_#{endpoint}_remote_open") do |event|
|
45
|
+
begin
|
46
|
+
delegate(:"on_#{endpoint}_open", event.context)
|
47
|
+
event.context.open if event.context.local_uninit?
|
48
|
+
rescue StopAutoResponse
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
define_method(:"on_#{endpoint}_remote_close") do |event|
|
53
|
+
delegate_error(:"on_#{endpoint}_error", event.context) if event.context.condition
|
54
|
+
begin
|
55
|
+
delegate(:"on_#{endpoint}_close", event.context)
|
56
|
+
event.context.close if event.context.local_active?
|
57
|
+
rescue StopAutoResponse
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
# Generate and include open_close modules for each endpoint type
|
63
|
+
# Using modules so we can override to extend the behavior later in the handler.
|
64
|
+
[:connection, :session, :link].each { |endpoint| include open_close(endpoint) }
|
65
|
+
|
66
|
+
def on_transport_error(event)
|
67
|
+
delegate_error(:on_transport_error, event.context)
|
68
|
+
end
|
69
|
+
|
70
|
+
def on_transport_closed(event)
|
71
|
+
delegate(:on_transport_close, event.context) rescue StopAutoResponse
|
72
|
+
end
|
73
|
+
|
74
|
+
# Add flow control for link opening events
|
75
|
+
def on_link_local_open(event) add_credit(event); end
|
76
|
+
def on_link_remote_open(event) super; add_credit(event); end
|
77
|
+
|
78
|
+
|
79
|
+
def on_delivery(event)
|
80
|
+
if event.link.receiver? # Incoming message
|
81
|
+
d = event.delivery
|
82
|
+
if d.aborted?
|
83
|
+
delegate(:on_delivery_abort, d)
|
84
|
+
elsif d.complete?
|
85
|
+
if d.link.local_closed? && d.receiver.auto_accept
|
86
|
+
d.release # Auto release after close
|
87
|
+
else
|
88
|
+
begin
|
89
|
+
delegate(:on_message, d, d.message)
|
90
|
+
d.accept if d.receiver.auto_accept && !d.settled?
|
91
|
+
rescue Reject
|
92
|
+
d.reject unless d.settled?
|
93
|
+
rescue Release
|
94
|
+
d.release unless d.settled?
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
delegate(:on_delivery_settle, d) if d.settled?
|
99
|
+
add_credit(event)
|
100
|
+
else # Outgoing message
|
101
|
+
t = event.tracker
|
102
|
+
case t.state
|
103
|
+
when Delivery::ACCEPTED then delegate(:on_tracker_accept, t)
|
104
|
+
when Delivery::REJECTED then delegate(:on_tracker_reject, t)
|
105
|
+
when Delivery::RELEASED then delegate(:on_tracker_release, t)
|
106
|
+
when Delivery::MODIFIED then delegate(:on_tracker_modify, t)
|
107
|
+
end
|
108
|
+
delegate(:on_tracker_settle, t) if t.settled?
|
109
|
+
t.settle if t.sender.auto_settle
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def on_link_flow(event)
|
114
|
+
add_credit(event)
|
115
|
+
sender = event.sender
|
116
|
+
delegate(:on_sendable, sender) if sender && sender.open? && sender.credit > 0
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_credit(event)
|
120
|
+
return unless (r = event.receiver)
|
121
|
+
if r.open? && (r.drained == 0) && r.credit_window && (r.credit_window > r.credit)
|
122
|
+
r.flow(r.credit_window - r.credit)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
# Licensed to the Apache Software Foundation (ASF) under one
|
3
2
|
# or more contributor license agreements. See the NOTICE file
|
4
3
|
# distributed with this work for additional information
|
@@ -15,202 +14,153 @@
|
|
15
14
|
# KIND, either express or implied. See the License for the
|
16
15
|
# specific language governing permissions and limitations
|
17
16
|
# under the License.
|
18
|
-
#++
|
19
|
-
|
20
|
-
module Qpid::Proton::Handler
|
21
|
-
|
22
|
-
# A general purpose handler that simplifies processing events.
|
23
|
-
#
|
24
|
-
class MessagingHandler < Qpid::Proton::BaseHandler
|
25
|
-
|
26
|
-
attr_reader :handlers
|
27
|
-
|
28
|
-
# Creates a new instance.
|
29
|
-
#
|
30
|
-
# @param [Integer] prefetch
|
31
|
-
# @param [Boolean] auto_accept
|
32
|
-
# @param [Boolean] auto_settle
|
33
|
-
# @param [Boolean] peer_close_is_error
|
34
|
-
#
|
35
|
-
def initialize(prefetch = 10, auto_accept = true, auto_settle = true, peer_close_is_error = false)
|
36
|
-
@handlers = Array.new
|
37
|
-
@handlers << CFlowController.new(prefetch) unless prefetch.zero?
|
38
|
-
@handlers << EndpointStateHandler.new(peer_close_is_error, self)
|
39
|
-
@handlers << IncomingMessageHandler.new(auto_accept, self)
|
40
|
-
@handlers << OutgoingMessageHandler.new(auto_settle,self)
|
41
|
-
end
|
42
17
|
|
43
|
-
# Called when the peer closes the connection with an error condition.
|
44
|
-
#
|
45
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
46
|
-
#
|
47
|
-
def on_connection_error(event)
|
48
|
-
EndpointStateHandler.print_error(event.connection, "connection")
|
49
|
-
end
|
50
18
|
|
51
|
-
|
52
|
-
|
53
|
-
|
19
|
+
module Qpid::Proton
|
20
|
+
module Handler
|
21
|
+
|
22
|
+
# @deprecated use {Qpid::Proton::MessagingHandler}
|
23
|
+
class MessagingHandler
|
24
|
+
include Util::Deprecation
|
25
|
+
|
26
|
+
# @private
|
27
|
+
def proton_adapter_class() Handler::ReactorMessagingAdapter; end
|
28
|
+
|
29
|
+
|
30
|
+
# @overload initialize(opts)
|
31
|
+
# Create a {MessagingHandler} with options +opts+
|
32
|
+
# @option opts [Integer] :prefetch (10)
|
33
|
+
# The number of messages to fetch in advance, 0 disables prefetch.
|
34
|
+
# @option opts [Boolean] :auto_accept (true)
|
35
|
+
# If true, incoming messages are accepted automatically after {#on_message}.
|
36
|
+
# If false, the application can accept, reject or release the message
|
37
|
+
# by calling methods on {Delivery} when the message has been processed.
|
38
|
+
# @option opts [Boolean] :auto_settle (true) If true, outgoing
|
39
|
+
# messages are settled automatically when the remote peer settles. If false,
|
40
|
+
# the application must call {Delivery#settle} explicitly.
|
41
|
+
# @option opts [Boolean] :auto_open (true)
|
42
|
+
# If true, incoming connections are opened automatically.
|
43
|
+
# If false, the application must call {Connection#open} to open incoming connections.
|
44
|
+
# @option opts [Boolean] :auto_close (true)
|
45
|
+
# If true, respond to a remote close automatically with a local close.
|
46
|
+
# If false, the application must call {Connection#close} to finish closing connections.
|
47
|
+
# @option opts [Boolean] :peer_close_is_error (false)
|
48
|
+
# If true, and the remote peer closes the connection without an error condition,
|
49
|
+
# the set the local error condition {Condition}("error", "unexpected peer close")
|
54
50
|
#
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
51
|
+
# @overload initialize(prefetch=10, auto_accept=true, auto_settle=true, peer_close_is_error=false)
|
52
|
+
# @deprecated use +initialize(opts)+ overload
|
53
|
+
def initialize(*args)
|
54
|
+
deprecated MessagingHandler, Qpid::Proton::MessagingHandler
|
55
|
+
@options = {}
|
56
|
+
if args.size == 1 && args[0].is_a?(Hash)
|
57
|
+
@options.replace(args[0])
|
58
|
+
else # Fill options from deprecated fixed arguments
|
59
|
+
[:prefetch, :auto_accept, :auto_settle, :peer_close_is_error].each do |k|
|
60
|
+
opts[k] = args.shift unless args.empty?
|
61
|
+
end
|
62
|
+
end
|
63
|
+
# NOTE: the options are processed by {Handler::Adapater}
|
64
|
+
end
|
65
|
+
|
66
|
+
public
|
67
|
+
|
68
|
+
# @return [Hash] handler options, see {#initialize}
|
69
|
+
attr_reader :options
|
70
|
+
|
71
|
+
# @!method on_transport_error(event)
|
72
|
+
# Called when the transport fails or closes unexpectedly.
|
73
|
+
# @param event [Event] The event.
|
74
|
+
|
75
|
+
# !@method on_connection_error(event)
|
76
|
+
# Called when the peer closes the connection with an error condition.
|
77
|
+
# @param event [Event] The event.
|
78
|
+
|
79
|
+
# @!method on_session_error(event)
|
80
|
+
# Called when the peer closes the session with an error condition.
|
81
|
+
# @param event [Qpid:Proton::Event] The event.
|
59
82
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
#
|
64
|
-
def on_link_error(event)
|
65
|
-
EndpointStateHandler.print_error(event.link, "link")
|
66
|
-
event.connection.close
|
67
|
-
end
|
83
|
+
# @!method on_link_error(event)
|
84
|
+
# Called when the peer closes the link with an error condition.
|
85
|
+
# @param event [Event] The event.
|
68
86
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
#
|
73
|
-
def on_reactor_init(event)
|
74
|
-
self.on_start(event)
|
75
|
-
end
|
87
|
+
# @!method on_start(event)
|
88
|
+
# Called when the event loop starts.
|
89
|
+
# @param event [Event] The event.
|
76
90
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
#
|
81
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
82
|
-
#
|
83
|
-
def on_start(event)
|
84
|
-
end
|
91
|
+
# @!method on_connection_closed(event)
|
92
|
+
# Called when the connection is closed.
|
93
|
+
# @param event [Event] The event.
|
85
94
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
#
|
90
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
91
|
-
#
|
92
|
-
def on_connection_closed(event)
|
93
|
-
end
|
95
|
+
# @!method on_session_closed(event)
|
96
|
+
# Called when the session is closed.
|
97
|
+
# @param event [Event] The event.
|
94
98
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
#
|
99
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
100
|
-
#
|
101
|
-
def on_session_closed(event)
|
102
|
-
end
|
99
|
+
# @!method on_link_closed(event)
|
100
|
+
# Called when the link is closed.
|
101
|
+
# @param event [Event] The event.
|
103
102
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
#
|
108
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
109
|
-
#
|
110
|
-
def on_link_closed(event)
|
111
|
-
end
|
103
|
+
# @!method on_connection_closing(event)
|
104
|
+
# Called when the peer initiates the closing of the connection.
|
105
|
+
# @param event [Event] The event.
|
112
106
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
#
|
117
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
118
|
-
#
|
119
|
-
def on_connection_closing(event)
|
120
|
-
end
|
107
|
+
# @!method on_session_closing(event)
|
108
|
+
# Called when the peer initiates the closing of the session.
|
109
|
+
# @param event [Event] The event.
|
121
110
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
#
|
126
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
127
|
-
#
|
128
|
-
def on_session_closing(event)
|
129
|
-
end
|
111
|
+
# @!method on_link_closing(event)
|
112
|
+
# Called when the peer initiates the closing of the link.
|
113
|
+
# @param event [Event] The event.
|
130
114
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
#
|
135
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
136
|
-
#
|
137
|
-
def on_link_closing(event)
|
138
|
-
end
|
115
|
+
# @!method on_disconnected(event)
|
116
|
+
# Called when the socket is disconnected.
|
117
|
+
# @param event [Event] The event.
|
139
118
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
145
|
-
#
|
146
|
-
def on_disconnected(event)
|
147
|
-
end
|
119
|
+
# @!method on_sendable(event)
|
120
|
+
# Called when the sender link has credit and messages can therefore
|
121
|
+
# be transferred.
|
122
|
+
# @param event [Event] The event.
|
148
123
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
# This method needs to be overridden.
|
153
|
-
#
|
154
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
155
|
-
#
|
156
|
-
def on_sendable(event)
|
157
|
-
end
|
124
|
+
# @!method on_accepted(event)
|
125
|
+
# Called when the remote peer accepts an outgoing message.
|
126
|
+
# @param event [Event] The event.
|
158
127
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
#
|
163
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
164
|
-
#
|
165
|
-
def on_accepted(event)
|
166
|
-
end
|
128
|
+
# @!method on_rejected(event)
|
129
|
+
# Called when the remote peer rejects an outgoing message.
|
130
|
+
# @param event [Event] The event.
|
167
131
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
#
|
172
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
173
|
-
#
|
174
|
-
def on_rejected(event)
|
175
|
-
end
|
132
|
+
# @!method on_released(event)
|
133
|
+
# Called when the remote peer releases an outgoing message for re-delivery as-is.
|
134
|
+
# @param event [Event] The event.
|
176
135
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
# MODIFIED state as defined by the AMPQ specification.
|
181
|
-
#
|
182
|
-
# This method needs to be overridden.
|
183
|
-
#
|
184
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
185
|
-
#
|
186
|
-
def on_released(event)
|
187
|
-
end
|
136
|
+
# @!method on_modified(event)
|
137
|
+
# Called when the remote peer releases an outgoing message for re-delivery with modifications.
|
138
|
+
# @param event [Event] The event.
|
188
139
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
# This method needs to be overridden.
|
194
|
-
#
|
195
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
196
|
-
#
|
197
|
-
def on_settled(event)
|
198
|
-
end
|
140
|
+
# @!method on_settled(event)
|
141
|
+
# Called when the remote peer has settled hte outgoing message.
|
142
|
+
# This is the point at which it should never be retransmitted.
|
143
|
+
# @param event [Event] The event.
|
199
144
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
#
|
207
|
-
# This method needs to be overridden.
|
208
|
-
#
|
209
|
-
# @param event [Qpid::Proton::Event::Event] The event.
|
210
|
-
#
|
211
|
-
def on_message(event)
|
212
|
-
end
|
145
|
+
# @!method on_message(event)
|
146
|
+
# Called when a message is received.
|
147
|
+
#
|
148
|
+
# The message is available from {Event#message}, to accept or reject the message
|
149
|
+
# use {Event#delivery}
|
150
|
+
# @param event [Event] The event.
|
213
151
|
|
214
|
-
|
152
|
+
# @!method on_aborted(event)
|
153
|
+
# Called when message delivery is aborted by the sender.
|
154
|
+
# The {Event#delivery} provides information about the delivery, but the message should be ignored.
|
215
155
|
|
156
|
+
# @!method on_error(event)
|
157
|
+
# If +on_xxx_error+ method is missing, {#on_error} is called instead.
|
158
|
+
# If {#on_error} is missing, the connection is closed with the error.
|
159
|
+
# @param event [Event] the event, {Event#method} provides the original method name.
|
160
|
+
|
161
|
+
# @!method on_unhandled(event)
|
162
|
+
# If an +on_xxx+ method is missing, {#on_unhandled} is called instead.
|
163
|
+
# @param event [Event] the event, {Event#method} provides the original method name.
|
164
|
+
end
|
165
|
+
end
|
216
166
|
end
|