Module: OnStomp::Connections::Stomp_1

Included in:
Stomp_1_0, Stomp_1_1
Defined in:
lib/onstomp/connections/stomp_1.rb

Overview

Connection behavior common to both STOMP 1.0 and STOMP 1.1 connections

Instance Method Summary (collapse)

Instance Method Details

- (OnStomp::Components::Frame) abort_frame(tx, h)

Creates an ABORT frame

Returns:



31
32
33
# File 'lib/onstomp/connections/stomp_1.rb', line 31

def abort_frame tx, h
  create_transaction_frame 'ABORT', tx, h
end

- (OnStomp::Components::Frame) begin_frame(tx, h)

Creates a BEGIN frame

Returns:



19
20
21
# File 'lib/onstomp/connections/stomp_1.rb', line 19

def begin_frame tx, h
  create_transaction_frame 'BEGIN', tx, h
end

- (OnStomp::Components::Frame) commit_frame(tx, h)

Creates a COMMIT frame

Returns:



25
26
27
# File 'lib/onstomp/connections/stomp_1.rb', line 25

def commit_frame tx, h
  create_transaction_frame 'COMMIT', tx, h
end

- (OnStomp::Components::Frame) connect_frame(*h)

Creates a CONNECT frame

Returns:



7
8
9
# File 'lib/onstomp/connections/stomp_1.rb', line 7

def connect_frame *h
  create_frame 'CONNECT', h
end

- (OnStomp::Components::Frame) disconnect_frame(h)

Creates a DISCONNECT frame

Returns:



37
38
39
# File 'lib/onstomp/connections/stomp_1.rb', line 37

def disconnect_frame h
  create_frame 'DISCONNECT', [h]
end

- (OnStomp::Components::Frame) send_frame(d, b, h)

Creates a SEND frame

Returns:



13
14
15
# File 'lib/onstomp/connections/stomp_1.rb', line 13

def send_frame d, b, h
  create_frame 'SEND', [h, {:destination => d}], b
end

- (OnStomp::Components::Frame) unsubscribe_frame(f, h)

Creates an UNSUBSCRIBE frame

Returns:



43
44
45
46
47
48
# File 'lib/onstomp/connections/stomp_1.rb', line 43

def unsubscribe_frame f, h
  id = f.is_a?(OnStomp::Components::Frame) ? f[:id] : f
  create_frame('UNSUBSCRIBE', [{:id => id}, h]).tap do |f|
    raise ArgumentError, 'subscription ID could not be determined' unless f.header?(:id)
  end
end