Debian Codegraph @

ruby/lib/handler/messaging_handler.rb

raw
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 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")
50 #
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.
82
83 # @!method on_link_error(event)
84 # Called when the peer closes the link with an error condition.
85 # @param event [Event] The event.
86
87 # @!method on_start(event)
88 # Called when the event loop starts.
89 # @param event [Event] The event.
90
91 # @!method on_connection_closed(event)
92 # Called when the connection is closed.
93 # @param event [Event] The event.
94
95 # @!method on_session_closed(event)
96 # Called when the session is closed.
97 # @param event [Event] The event.
98
99 # @!method on_link_closed(event)
100 # Called when the link is closed.
101 # @param event [Event] The event.
102
103 # @!method on_connection_closing(event)
104 # Called when the peer initiates the closing of the connection.
105 # @param event [Event] The event.
106
107 # @!method on_session_closing(event)
108 # Called when the peer initiates the closing of the session.
109 # @param event [Event] The event.
110
111 # @!method on_link_closing(event)
112 # Called when the peer initiates the closing of the link.
113 # @param event [Event] The event.
114
115 # @!method on_disconnected(event)
116 # Called when the socket is disconnected.
117 # @param event [Event] The event.
118
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.
123
124 # @!method on_accepted(event)
125 # Called when the remote peer accepts an outgoing message.
126 # @param event [Event] The event.
127
128 # @!method on_rejected(event)
129 # Called when the remote peer rejects an outgoing message.
130 # @param event [Event] The event.
131
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.
135
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.
139
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.
144
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.
151
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.
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
166 end