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)

Broker Frame Event Bindings (collapse)

Frame Exchange Event Bindings (collapse)

Instance Method Summary (collapse)

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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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.

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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.

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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.

Returns:

  • ({Symbol => Array<Proc>})


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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



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)

Parameters:



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).

Parameters:



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).

Parameters:



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).

Parameters:



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)

Parameters:

  • f (OnStomp::Components::Frame)

    the frame trigger this event

  • pref (:on, :before, etc)

    the prefix for the event name

  • origin (:client, :broker)


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

Yields:

  • (frame, client)

    callback invoked when event is triggered

Yield Parameters:



69
# File 'lib/onstomp/interfaces/client_events.rb', line 69

create_event_methods :unsubscribe, :before, :on