Class: OnStomp::Components::URI::STOMP

Inherits:
URI::Generic
  • Object
show all
Defined in:
lib/onstomp/components/uri.rb,
lib/onstomp/open-uri.rb

Overview

A URI class for representing URIs with a 'stomp' scheme.

Direct Known Subclasses

STOMP_SSL, Failover::URI::FAILOVER

Constant Summary

DEFAULT_PORT =

The default port to use for these kinds of URI objects when none has been specified.

61613

Instance Method Summary (collapse)

Instance Method Details

- (:tcp) onstomp_socket_type

The type of socket to use with these kinds of URI objects.

Returns:

  • (:tcp)


12
# File 'lib/onstomp/components/uri.rb', line 12

def onstomp_socket_type; :tcp; end

- (OnStomp::Client) open(*args) {|client| ... }

Creates a new OnStomp::Client, extends it with OpenURI::ClientExtensions and either returns it directly or connects it, yields it to a given block and the disconnects it.

Parameters:

Yields:

  • (client)

    block to evaluate within a connected client

Yield Parameters:

Returns:



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/onstomp/open-uri.rb', line 12

def open(*args)
  client = OnStomp::Client.new(self, *args)
  client.extend OnStomp::OpenURI::ClientExtensions
  client.auto_destination = self.path
  if block_given?
    begin
      client.connect
      yield client
    ensure
      client.disconnect
    end
  end
  client
end