Class: Qpid::Proton::Handler::MessagingHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Qpid::Proton::Handler::MessagingHandler
- Defined in:
- lib/handler/messaging_handler.rb
Overview
A general purpose handler that simplifies processing events.
Instance Attribute Summary collapse
-
#handlers ⇒ Object
readonly
Returns the value of attribute handlers.
Instance Method Summary collapse
-
#initialize(prefetch = 10, auto_accept = true, auto_settle = true, peer_close_is_error = false) ⇒ MessagingHandler
constructor
Creates a new instance.
-
#on_accepted(event) ⇒ Object
Called when the remote peer accepts an outgoing message.
-
#on_connection_closed(event) ⇒ Object
Called when the connection is closed.
-
#on_connection_closing(event) ⇒ Object
Called when the peer initiates the closing of the connection.
-
#on_connection_error(event) ⇒ Object
Called when the peer closes the connection with an error condition.
-
#on_disconnected(event) ⇒ Object
Called when the socket is disconnected.
-
#on_link_closed(event) ⇒ Object
Called when the link is closed.
-
#on_link_closing(event) ⇒ Object
Called when the peer initiates the closing of the link.
-
#on_link_error(event) ⇒ Object
Called when the peer closes the link with an error condition.
-
#on_message(event) ⇒ Object
Called when a message is received.
-
#on_reactor_init(event) ⇒ Object
Called when the event loop starts.
-
#on_rejected(event) ⇒ Object
Called when the remote peer rejects an outgoing message.
-
#on_released(event) ⇒ Object
Called when the remote peer releases an outgoing message.
-
#on_sendable(event) ⇒ Object
Called when the sender link has credit and messages can therefore be transferred.
-
#on_session_closed(event) ⇒ Object
Called when the session is closed.
-
#on_session_closing(event) ⇒ Object
Called when the peer initiates the closing of the session.
-
#on_session_error(event) ⇒ Object
Called when the peer closes the session with an error condition.
-
#on_settled(event) ⇒ Object
Called when the remote peer has settled hte outgoing message.
-
#on_start(event) ⇒ Object
Called when the event loop starts.
Methods inherited from BaseHandler
Constructor Details
#initialize(prefetch = 10, auto_accept = true, auto_settle = true, peer_close_is_error = false) ⇒ MessagingHandler
Creates a new instance.
37 38 39 40 41 42 43 |
# File 'lib/handler/messaging_handler.rb', line 37 def initialize(prefetch = 10, auto_accept = true, auto_settle = true, peer_close_is_error = false) @handlers = Array.new @handlers << CFlowController.new(prefetch) unless prefetch.zero? @handlers << EndpointStateHandler.new(peer_close_is_error, self) @handlers << IncomingMessageHandler.new(auto_accept, self) @handlers << OutgoingMessageHandler.new(auto_settle,self) end |
Instance Attribute Details
#handlers ⇒ Object (readonly)
Returns the value of attribute handlers.
28 29 30 |
# File 'lib/handler/messaging_handler.rb', line 28 def handlers @handlers end |
Instance Method Details
#on_accepted(event) ⇒ Object
Called when the remote peer accepts an outgoing message.
This method needs to be overridden.
167 168 |
# File 'lib/handler/messaging_handler.rb', line 167 def on_accepted(event) end |
#on_connection_closed(event) ⇒ Object
Called when the connection is closed.
This method needs to be overridden.
94 95 |
# File 'lib/handler/messaging_handler.rb', line 94 def on_connection_closed(event) end |
#on_connection_closing(event) ⇒ Object
Called when the peer initiates the closing of the connection.
This method needs to be overridden.
121 122 |
# File 'lib/handler/messaging_handler.rb', line 121 def on_connection_closing(event) end |
#on_connection_error(event) ⇒ Object
Called when the peer closes the connection with an error condition.
49 50 51 |
# File 'lib/handler/messaging_handler.rb', line 49 def on_connection_error(event) EndpointStateHandler.print_error(event.connection, "connection") end |
#on_disconnected(event) ⇒ Object
Called when the socket is disconnected.
This method needs to be overridden.
148 149 |
# File 'lib/handler/messaging_handler.rb', line 148 def on_disconnected(event) end |
#on_link_closed(event) ⇒ Object
Called when the link is closed.
This method needs to be overridden.
112 113 |
# File 'lib/handler/messaging_handler.rb', line 112 def on_link_closed(event) end |
#on_link_closing(event) ⇒ Object
Called when the peer initiates the closing of the link.
This method needs to be overridden.
139 140 |
# File 'lib/handler/messaging_handler.rb', line 139 def on_link_closing(event) end |
#on_link_error(event) ⇒ Object
Called when the peer closes the link with an error condition.
66 67 68 69 |
# File 'lib/handler/messaging_handler.rb', line 66 def on_link_error(event) EndpointStateHandler.print_error(event.link, "link") event.connection.close end |
#on_message(event) ⇒ Object
Called when a message is received.
The message itself can be obtained as a property on the event. For the purpose of referring to this message in further actions, such as explicitly accepting it) the delivery should be used. This is also obtainable vi a property on the event.
This method needs to be overridden.
213 214 |
# File 'lib/handler/messaging_handler.rb', line 213 def (event) end |
#on_reactor_init(event) ⇒ Object
Called when the event loop starts.
75 76 77 |
# File 'lib/handler/messaging_handler.rb', line 75 def on_reactor_init(event) self.on_start(event) end |
#on_rejected(event) ⇒ Object
Called when the remote peer rejects an outgoing message.
This method needs to be overridden.
176 177 |
# File 'lib/handler/messaging_handler.rb', line 176 def on_rejected(event) end |
#on_released(event) ⇒ Object
Called when the remote peer releases an outgoing message.
Note that this may be in response to either the RELEASE or MODIFIED state as defined by the AMPQ specification.
This method needs to be overridden.
188 189 |
# File 'lib/handler/messaging_handler.rb', line 188 def on_released(event) end |
#on_sendable(event) ⇒ Object
Called when the sender link has credit and messages can therefore be transferred.
This method needs to be overridden.
158 159 |
# File 'lib/handler/messaging_handler.rb', line 158 def on_sendable(event) end |
#on_session_closed(event) ⇒ Object
Called when the session is closed.
This method needs to be overridden.
103 104 |
# File 'lib/handler/messaging_handler.rb', line 103 def on_session_closed(event) end |
#on_session_closing(event) ⇒ Object
Called when the peer initiates the closing of the session.
This method needs to be overridden.
130 131 |
# File 'lib/handler/messaging_handler.rb', line 130 def on_session_closing(event) end |
#on_session_error(event) ⇒ Object
Called when the peer closes the session with an error condition.
57 58 59 60 |
# File 'lib/handler/messaging_handler.rb', line 57 def on_session_error(event) EndpointStateHandler.print_error(event.session, "session") event.connection.close end |
#on_settled(event) ⇒ Object
Called when the remote peer has settled hte outgoing message.
This is the point at which it should never be retransmitted.
This method needs to be overridden.
199 200 |
# File 'lib/handler/messaging_handler.rb', line 199 def on_settled(event) end |
#on_start(event) ⇒ Object
Called when the event loop starts.
This method needs to be overridden.
85 86 |
# File 'lib/handler/messaging_handler.rb', line 85 def on_start(event) end |