Module: OnStomp::Interfaces::ClientConfigurable::ClassMethods

Defined in:
lib/onstomp/interfaces/client_configurable.rb

Overview

Provides attribute methods for client objects.

Instance Method Summary (collapse)

Instance Method Details

- (Object) attr_configurable_client_beats(nm)

Note:

This attribute is only useful with STOMP 1.1 connections.

Creates a readable and writeable attribute with the given name that defaults to [0, 0] and is mapped to a pair of non-negative integers when assigned. Corresponds to what heartbeating strategy should be used for a given client's connection where [0, 0] indicates no heartbeating should be performed.

Parameters:

  • nm (Symbol)

    name of attribute



36
37
38
39
40
# File 'lib/onstomp/interfaces/client_configurable.rb', line 36

def attr_configurable_client_beats nm
  attr_configurable_arr(nm, :default => [0,0]) do |val|
    val.map { |b| bi = b.to_i; bi < 0 ? 0 : bi }
  end
end

- (Object) attr_configurable_processor(nm)

Creates a readable and writeable attribute with the given name that defaults to the Components::ThreadedProcessor. Corresponds the the class to use when create new processor instances when a client is connected.

Parameters:

  • nm (Symbol)

    name of attribute



47
48
49
# File 'lib/onstomp/interfaces/client_configurable.rb', line 47

def attr_configurable_processor nm
  attr_configurable_class(nm, :default => OnStomp::Components::ThreadedProcessor)
end

- (Object) attr_configurable_protocols(nm)

Creates a readable and writeable attribute with the given name that defaults to the supported protocol versions and is filtered to those versions when assigned. Corresponds to which protocol versions should be used for a given client's connection.

Parameters:

  • nm (Symbol)

    name of attribute



21
22
23
24
25
26
27
# File 'lib/onstomp/interfaces/client_configurable.rb', line 21

def attr_configurable_protocols nm
  attr_configurable_arr(nm, :default => OnStomp::Connections.supported) do |vers|
    OnStomp::Connections.select_supported(vers).tap do |valid|
      raise OnStomp::UnsupportedProtocolVersionError, vers.inspect if valid.empty?
    end
  end
end