Module: OnStomp::Interfaces::ClientEvents
- Includes:
- EventManager
- Included in:
- Client
- Defined in:
- lib/onstomp/interfaces/client_events.rb
Overview
Mixin for client events
There are a few special event methods that will be passed on
to the client's connection, they are:
* on_connection_established
=> OnStomp::Interfaces::ConnectionEvents#on_established
* on_connection_died
=> OnStomp::Interfaces::ConnectionEvents#on_died
* on_connection_terminated
=> OnStomp::Interfaces::ConnectionEvents#on_terminated
* on_connection_closed
=> OnStomp::Interfaces::ConnectionEvents#on_closed
Client Frame Event Bindings (collapse)
-
- (Object) :begin {|frame, client| ... }
Binds a callback to be invoked when a BEGIN frame is transmitted.
-
- (Object) abort {|frame, client| ... }
Binds a callback to be invoked when an ABORT frame is transmitted.
-
- (Object) ack {|frame, client| ... }
Binds a callback to be invoked when an ACK frame is transmitted.
-
- (Object) before_abort {|frame, client| ... }
Binds a callback to be invoked when an ABORT frame is transmitted.
-
- (Object) before_ack {|frame, client| ... }
Binds a callback to be invoked when an ACK frame is transmitted.
-
- (Object) before_begin {|frame, client| ... }
Binds a callback to be invoked when a BEGIN frame is transmitted.
-
- (Object) before_client_beat {|frame, client| ... }
Binds a callback to be invoked when a client heartbeat is transmitted.
-
- (Object) before_commit {|frame, client| ... }
Binds a callback to be invoked when a COMMIT frame is transmitted.
-
- (Object) before_disconnect {|frame, client| ... }
Binds a callback to be invoked when a DISCONNECT frame is transmitted.
-
- (Object) before_nack {|frame, client| ... }
Binds a callback to be invoked when a NACK frame is transmitted.
-
- (Object) before_send {|frame, client| ... }
Binds a callback to be invoked when a SEND frame is transmitted.
-
- (Object) before_subscribe {|frame, client| ... }
Binds a callback to be invoked when a SUBSCRIBE frame is transmitted.
-
- (Object) before_unsubscribe {|frame, client| ... }
Binds a callback to be invoked when an UNSUBSCRIBE frame is transmitted.
-
- (Object) client_beat {|frame, client| ... }
Binds a callback to be invoked when a client heartbeat is transmitted.
-
- (Object) commit {|frame, client| ... }
Binds a callback to be invoked when a COMMIT frame is transmitted.
-
- (Object) connect {|frame, client| ... }
Can't get
before
because the CONNECT frame isn't transmitted by the client. -
- (Object) disconnect {|frame, client| ... }
Binds a callback to be invoked when a DISCONNECT frame is transmitted.
-
- (Object) nack {|frame, client| ... }
Binds a callback to be invoked when a NACK frame is transmitted.
-
- (Object) on_abort {|frame, client| ... }
Binds a callback to be invoked when an ABORT frame is transmitted.
-
- (Object) on_ack {|frame, client| ... }
Binds a callback to be invoked when an ACK frame is transmitted.
-
- (Object) on_begin {|frame, client| ... }
Binds a callback to be invoked when a BEGIN frame is transmitted.
-
- (Object) on_client_beat {|frame, client| ... }
Binds a callback to be invoked when a client heartbeat is transmitted.
-
- (Object) on_commit {|frame, client| ... }
Binds a callback to be invoked when a COMMIT frame is transmitted.
-
- (Object) on_connect {|frame, client| ... }
Can't get
before
because the CONNECT frame isn't transmitted by the client. -
- (Object) on_disconnect {|frame, client| ... }
Binds a callback to be invoked when a DISCONNECT frame is transmitted.
-
- (Object) on_nack {|frame, client| ... }
Binds a callback to be invoked when a NACK frame is transmitted.
-
- (Object) on_send {|frame, client| ... }
Binds a callback to be invoked when a SEND frame is transmitted.
-
- (Object) on_subscribe {|frame, client| ... }
Binds a callback to be invoked when a SUBSCRIBE frame is transmitted.
-
- (Object) on_unsubscribe {|frame, client| ... }
Binds a callback to be invoked when an UNSUBSCRIBE frame is transmitted.
-
- (Object) send {|frame, client| ... }
Binds a callback to be invoked when a SEND frame is transmitted.
-
- (Object) subscribe {|frame, client| ... }
Binds a callback to be invoked when a SUBSCRIBE frame is transmitted.
-
- (Object) unsubscribe {|frame, client| ... }
Binds a callback to be invoked when an UNSUBSCRIBE frame is transmitted.
Broker Frame Event Bindings (collapse)
-
- (Object) before_broker_beat {|frame, client| ... }
Binds a callback to be invoked when a broker heartbeat is received.
-
- (Object) before_error {|frame, client| ... }
Binds a callback to be invoked when an ERROR frame is received.
-
- (Object) before_message {|frame, client| ... }
Binds a callback to be invoked when a MESSAGE frame is received.
-
- (Object) before_receipt {|frame, client| ... }
Binds a callback to be invoked when a RECEIPT frame is received.
-
- (Object) broker_beat {|frame, client| ... }
Binds a callback to be invoked when a broker heartbeat is received.
-
- (Object) error {|frame, client| ... }
Binds a callback to be invoked when an ERROR frame is received.
-
- (Object) message {|frame, client| ... }
Binds a callback to be invoked when a MESSAGE frame is received.
-
- (Object) on_broker_beat {|frame, client| ... }
Binds a callback to be invoked when a broker heartbeat is received.
-
- (Object) on_error {|frame, client| ... }
Binds a callback to be invoked when an ERROR frame is received.
-
- (Object) on_message {|frame, client| ... }
Binds a callback to be invoked when a MESSAGE frame is received.
-
- (Object) on_receipt {|frame, client| ... }
Binds a callback to be invoked when a RECEIPT frame is received.
-
- (Object) receipt {|frame, client| ... }
Binds a callback to be invoked when a RECEIPT frame is received.
Frame Exchange Event Bindings (collapse)
-
- (Object) after_receiving {|frame, client| ... }
Binds a callback to be invoked when any frame is received.
-
- (Object) after_transmitting {|frame, client| ... }
Binds a callback to be invoked when any frame is transmitted.
-
- (Object) before_receiving {|frame, client| ... }
Binds a callback to be invoked when any frame is received.
-
- (Object) before_transmitting {|frame, client| ... }
Binds a callback to be invoked when any frame is transmitted.
-
- (Object) receiving {|frame, client| ... }
Binds a callback to be invoked when any frame is received.
-
- (Object) transmitting {|frame, client| ... }
Binds a callback to be invoked when any frame is transmitted.
Instance Method Summary (collapse)
-
- ({Symbol => Array<Proc>}) pending_connection_events
Returns a hash of event bindings that should be set on a connection, but were set on the client because the connection does not exist yet.
-
- (Object) trigger_after_receiving(f)
Triggers the :after_receiving event and the
on
prefixed frame specific event (eg::on_message
). -
- (Object) trigger_after_transmitting(f)
Triggers the :after_transmitting event and the
on
prefixed frame specific event (eg::on_send
). -
- (Object) trigger_before_receiving(f)
Triggers the :before_receiving event and the
before
prefixed frame specific event (eg::before_error
). -
- (Object) trigger_before_transmitting(f)
Triggers the :before_transmitting event and the
before
prefixed frame specific event (eg::before_disconnect
). -
- (Object) trigger_frame_event(f, pref, origin)
Triggers an event named by the supplied frame, prefixed with the supplied prefix.
Methods included from EventManager
#bind_event, #event_callbacks, included, #trigger_event
Instance Method Details
- (Object) :begin {|frame, client| ... }
Binds a callback to be invoked when a BEGIN frame is transmitted
39 |
# File 'lib/onstomp/interfaces/client_events.rb', line 39 create_event_methods :begin, :before, :on |
- (Object) abort {|frame, client| ... }
Binds a callback to be invoked when an ABORT frame is transmitted
45 |
# File 'lib/onstomp/interfaces/client_events.rb', line 45 create_event_methods :abort, :before, :on |
- (Object) ack {|frame, client| ... }
Binds a callback to be invoked when an ACK frame is transmitted
27 |
# File 'lib/onstomp/interfaces/client_events.rb', line 27 create_event_methods :ack, :before, :on |
- (Object) after_receiving {|frame, client| ... }
Binds a callback to be invoked when any frame is received
123 |
# File 'lib/onstomp/interfaces/client_events.rb', line 123 create_event_methods :receiving, :before, :after |
- (Object) after_transmitting {|frame, client| ... }
Binds a callback to be invoked when any frame is transmitted
117 |
# File 'lib/onstomp/interfaces/client_events.rb', line 117 create_event_methods :transmitting, :before, :after |
- (Object) before_abort {|frame, client| ... }
Binds a callback to be invoked when an ABORT frame is transmitted
45 |
# File 'lib/onstomp/interfaces/client_events.rb', line 45 create_event_methods :abort, :before, :on |
- (Object) before_ack {|frame, client| ... }
Binds a callback to be invoked when an ACK frame is transmitted
27 |
# File 'lib/onstomp/interfaces/client_events.rb', line 27 create_event_methods :ack, :before, :on |
- (Object) before_begin {|frame, client| ... }
Binds a callback to be invoked when a BEGIN frame is transmitted
39 |
# File 'lib/onstomp/interfaces/client_events.rb', line 39 create_event_methods :begin, :before, :on |
- (Object) before_broker_beat {|frame, client| ... }
Binds a callback to be invoked when a broker heartbeat is received
108 |
# File 'lib/onstomp/interfaces/client_events.rb', line 108 create_event_methods :broker_beat, :before, :on |
- (Object) before_client_beat {|frame, client| ... }
Binds a callback to be invoked when a client heartbeat is transmitted
81 |
# File 'lib/onstomp/interfaces/client_events.rb', line 81 create_event_methods :client_beat, :before, :on |
- (Object) before_commit {|frame, client| ... }
Binds a callback to be invoked when a COMMIT frame is transmitted
51 |
# File 'lib/onstomp/interfaces/client_events.rb', line 51 create_event_methods :commit, :before, :on |
- (Object) before_disconnect {|frame, client| ... }
Binds a callback to be invoked when a DISCONNECT frame is transmitted
75 |
# File 'lib/onstomp/interfaces/client_events.rb', line 75 create_event_methods :disconnect, :before, :on |
- (Object) before_error {|frame, client| ... }
Binds a callback to be invoked when an ERROR frame is received
90 |
# File 'lib/onstomp/interfaces/client_events.rb', line 90 create_event_methods :error, :before, :on |
- (Object) before_message {|frame, client| ... }
Binds a callback to be invoked when a MESSAGE frame is received
96 |
# File 'lib/onstomp/interfaces/client_events.rb', line 96 create_event_methods :message, :before, :on |
- (Object) before_nack {|frame, client| ... }
Binds a callback to be invoked when a NACK frame is transmitted
33 |
# File 'lib/onstomp/interfaces/client_events.rb', line 33 create_event_methods :nack, :before, :on |
- (Object) before_receipt {|frame, client| ... }
Binds a callback to be invoked when a RECEIPT frame is received
102 |
# File 'lib/onstomp/interfaces/client_events.rb', line 102 create_event_methods :receipt, :before, :on |
- (Object) before_receiving {|frame, client| ... }
Binds a callback to be invoked when any frame is received
123 |
# File 'lib/onstomp/interfaces/client_events.rb', line 123 create_event_methods :receiving, :before, :after |
- (Object) before_send {|frame, client| ... }
Binds a callback to be invoked when a SEND frame is transmitted
57 |
# File 'lib/onstomp/interfaces/client_events.rb', line 57 create_event_methods :send, :before, :on |
- (Object) before_subscribe {|frame, client| ... }
Binds a callback to be invoked when a SUBSCRIBE frame is transmitted
63 |
# File 'lib/onstomp/interfaces/client_events.rb', line 63 create_event_methods :subscribe, :before, :on |
- (Object) before_transmitting {|frame, client| ... }
Binds a callback to be invoked when any frame is transmitted
117 |
# File 'lib/onstomp/interfaces/client_events.rb', line 117 create_event_methods :transmitting, :before, :after |
- (Object) before_unsubscribe {|frame, client| ... }
Binds a callback to be invoked when an UNSUBSCRIBE frame is transmitted
69 |
# File 'lib/onstomp/interfaces/client_events.rb', line 69 create_event_methods :unsubscribe, :before, :on |
- (Object) broker_beat {|frame, client| ... }
Binds a callback to be invoked when a broker heartbeat is received
108 |
# File 'lib/onstomp/interfaces/client_events.rb', line 108 create_event_methods :broker_beat, :before, :on |
- (Object) client_beat {|frame, client| ... }
Binds a callback to be invoked when a client heartbeat is transmitted
81 |
# File 'lib/onstomp/interfaces/client_events.rb', line 81 create_event_methods :client_beat, :before, :on |
- (Object) commit {|frame, client| ... }
Binds a callback to be invoked when a COMMIT frame is transmitted
51 |
# File 'lib/onstomp/interfaces/client_events.rb', line 51 create_event_methods :commit, :before, :on |
- (Object) connect {|frame, client| ... }
Can't get before
because the CONNECT frame isn't transmitted by
the client.
21 |
# File 'lib/onstomp/interfaces/client_events.rb', line 21 create_event_methods :connect, :on |
- (Object) disconnect {|frame, client| ... }
Binds a callback to be invoked when a DISCONNECT frame is transmitted
75 |
# File 'lib/onstomp/interfaces/client_events.rb', line 75 create_event_methods :disconnect, :before, :on |
- (Object) error {|frame, client| ... }
Binds a callback to be invoked when an ERROR frame is received
90 |
# File 'lib/onstomp/interfaces/client_events.rb', line 90 create_event_methods :error, :before, :on |
- (Object) message {|frame, client| ... }
Binds a callback to be invoked when a MESSAGE frame is received
96 |
# File 'lib/onstomp/interfaces/client_events.rb', line 96 create_event_methods :message, :before, :on |
- (Object) nack {|frame, client| ... }
Binds a callback to be invoked when a NACK frame is transmitted
33 |
# File 'lib/onstomp/interfaces/client_events.rb', line 33 create_event_methods :nack, :before, :on |
- (Object) on_abort {|frame, client| ... }
Binds a callback to be invoked when an ABORT frame is transmitted
45 |
# File 'lib/onstomp/interfaces/client_events.rb', line 45 create_event_methods :abort, :before, :on |
- (Object) on_ack {|frame, client| ... }
Binds a callback to be invoked when an ACK frame is transmitted
27 |
# File 'lib/onstomp/interfaces/client_events.rb', line 27 create_event_methods :ack, :before, :on |
- (Object) on_begin {|frame, client| ... }
Binds a callback to be invoked when a BEGIN frame is transmitted
39 |
# File 'lib/onstomp/interfaces/client_events.rb', line 39 create_event_methods :begin, :before, :on |
- (Object) on_broker_beat {|frame, client| ... }
Binds a callback to be invoked when a broker heartbeat is received
108 |
# File 'lib/onstomp/interfaces/client_events.rb', line 108 create_event_methods :broker_beat, :before, :on |
- (Object) on_client_beat {|frame, client| ... }
Binds a callback to be invoked when a client heartbeat is transmitted
81 |
# File 'lib/onstomp/interfaces/client_events.rb', line 81 create_event_methods :client_beat, :before, :on |
- (Object) on_commit {|frame, client| ... }
Binds a callback to be invoked when a COMMIT frame is transmitted
51 |
# File 'lib/onstomp/interfaces/client_events.rb', line 51 create_event_methods :commit, :before, :on |
- (Object) on_connect {|frame, client| ... }
Can't get before
because the CONNECT frame isn't transmitted by
the client.
21 |
# File 'lib/onstomp/interfaces/client_events.rb', line 21 create_event_methods :connect, :on |
- (Object) on_disconnect {|frame, client| ... }
Binds a callback to be invoked when a DISCONNECT frame is transmitted
75 |
# File 'lib/onstomp/interfaces/client_events.rb', line 75 create_event_methods :disconnect, :before, :on |
- (Object) on_error {|frame, client| ... }
Binds a callback to be invoked when an ERROR frame is received
90 |
# File 'lib/onstomp/interfaces/client_events.rb', line 90 create_event_methods :error, :before, :on |
- (Object) on_message {|frame, client| ... }
Binds a callback to be invoked when a MESSAGE frame is received
96 |
# File 'lib/onstomp/interfaces/client_events.rb', line 96 create_event_methods :message, :before, :on |
- (Object) on_nack {|frame, client| ... }
Binds a callback to be invoked when a NACK frame is transmitted
33 |
# File 'lib/onstomp/interfaces/client_events.rb', line 33 create_event_methods :nack, :before, :on |
- (Object) on_receipt {|frame, client| ... }
Binds a callback to be invoked when a RECEIPT frame is received
102 |
# File 'lib/onstomp/interfaces/client_events.rb', line 102 create_event_methods :receipt, :before, :on |
- (Object) on_send {|frame, client| ... }
Binds a callback to be invoked when a SEND frame is transmitted
57 |
# File 'lib/onstomp/interfaces/client_events.rb', line 57 create_event_methods :send, :before, :on |
- (Object) on_subscribe {|frame, client| ... }
Binds a callback to be invoked when a SUBSCRIBE frame is transmitted
63 |
# File 'lib/onstomp/interfaces/client_events.rb', line 63 create_event_methods :subscribe, :before, :on |
- (Object) on_unsubscribe {|frame, client| ... }
Binds a callback to be invoked when an UNSUBSCRIBE frame is transmitted
69 |
# File 'lib/onstomp/interfaces/client_events.rb', line 69 create_event_methods :unsubscribe, :before, :on |
- ({Symbol => Array<Proc>}) pending_connection_events
Returns a hash of event bindings that should be set on a connection, but were set on the client because the connection does not exist yet.
144 145 146 |
# File 'lib/onstomp/interfaces/client_events.rb', line 144 def pending_connection_events @pending_connection_events ||= Hash.new { |h,k| h[k] = [] } end |
- (Object) receipt {|frame, client| ... }
Binds a callback to be invoked when a RECEIPT frame is received
102 |
# File 'lib/onstomp/interfaces/client_events.rb', line 102 create_event_methods :receipt, :before, :on |
- (Object) receiving {|frame, client| ... }
Binds a callback to be invoked when any frame is received
123 |
# File 'lib/onstomp/interfaces/client_events.rb', line 123 create_event_methods :receiving, :before, :after |
- (Object) send {|frame, client| ... }
Binds a callback to be invoked when a SEND frame is transmitted
57 |
# File 'lib/onstomp/interfaces/client_events.rb', line 57 create_event_methods :send, :before, :on |
- (Object) subscribe {|frame, client| ... }
Binds a callback to be invoked when a SUBSCRIBE frame is transmitted
63 |
# File 'lib/onstomp/interfaces/client_events.rb', line 63 create_event_methods :subscribe, :before, :on |
- (Object) transmitting {|frame, client| ... }
Binds a callback to be invoked when any frame is transmitted
117 |
# File 'lib/onstomp/interfaces/client_events.rb', line 117 create_event_methods :transmitting, :before, :after |
- (Object) trigger_after_receiving(f)
Triggers the :after_receiving event and the
on
prefixed frame specific event (eg: :on_message
)
171 172 173 174 |
# File 'lib/onstomp/interfaces/client_events.rb', line 171 def trigger_after_receiving f trigger_event :after_receiving, f, self trigger_frame_event f, :on, :broker end |
- (Object) trigger_after_transmitting(f)
Triggers the :after_transmitting event and the
on
prefixed frame specific event (eg: :on_send
).
187 188 189 190 |
# File 'lib/onstomp/interfaces/client_events.rb', line 187 def trigger_after_transmitting f trigger_event :after_transmitting, f, self trigger_frame_event f, :on, :client end |
- (Object) trigger_before_receiving(f)
Triggers the :before_receiving event and the
before
prefixed frame specific event (eg: :before_error
).
163 164 165 166 |
# File 'lib/onstomp/interfaces/client_events.rb', line 163 def trigger_before_receiving f trigger_event :before_receiving, f, self trigger_frame_event f, :before, :broker end |
- (Object) trigger_before_transmitting(f)
Triggers the :before_transmitting event and the
before
prefixed frame specific event (eg: :before_disconnect
).
179 180 181 182 |
# File 'lib/onstomp/interfaces/client_events.rb', line 179 def trigger_before_transmitting f trigger_event :before_transmitting, f, self trigger_frame_event f, :before, :client end |
- (Object) trigger_frame_event(f, pref, origin)
Triggers an event named by the supplied frame, prefixed with the supplied prefix. If the supplied frame is a 'heart-beat', origin will be used to dispatch appropriate heart-beat event (client_beat or broker_beat)
154 155 156 157 158 |
# File 'lib/onstomp/interfaces/client_events.rb', line 154 def trigger_frame_event f, pref, origin e = f.command ? :#{pref}_#{f.command.downcase}" : :#{pref}_#{origin}_beat" trigger_event e, f, self end |
- (Object) unsubscribe {|frame, client| ... }
Binds a callback to be invoked when an UNSUBSCRIBE frame is transmitted
69 |
# File 'lib/onstomp/interfaces/client_events.rb', line 69 create_event_methods :unsubscribe, :before, :on |