Module: JSparrow::Connection

Defined in:
lib/connection/provider.rb,
lib/connection/configuration.rb

Defined Under Namespace

Classes: Configuration, InitializationError, InvalidStateError, Provider

Class Method Summary collapse

Class Method Details

.configurationObject



25
26
27
# File 'lib/connection/configuration.rb', line 25

def configuration
  @@configuration
end

.configure(&block) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/connection/configuration.rb', line 17

def configure(&block)
  @@configuration = Configuration.new

  class_eval(&block)

  @@configuration
end

.enable_connection_factories(jndi_names = {}) ⇒ Object

Example:

enable_connection_factories :queue_connection_factory => "jndi_name_of_queue_connection_factory",
                            :topic_connection_factory => "jndi_name_of_topic_connection_factory"


54
55
56
# File 'lib/connection/configuration.rb', line 54

def enable_connection_factories(jndi_names = {})
  configuration.enabled_connection_factories = jndi_names
end

.enable_queues(jndi_names = {}) ⇒ Object

Example:

enable_queues :a_queue_name_in_lower_case     => "jndi_name_of_a_queue",
              :other_queue_name_in_lower_case => "jndi_name_of_other_queue"


64
65
66
# File 'lib/connection/configuration.rb', line 64

def enable_queues(jndi_names = {})
  configuration.enabled_queues = jndi_names
end

.enable_topics(jndi_names = {}) ⇒ Object

Example:

enable_topics :a_topic_name_in_lower_case     => "jndi_name_of_a_topic",
              :other_topic_name_in_lower_case => "jndi_name_of_other_topic"


74
75
76
# File 'lib/connection/configuration.rb', line 74

def enable_topics(jndi_names = {})
  configuration.enabled_topics = jndi_names
end

.newObject

Factory method.



82
83
84
85
86
# File 'lib/connection/configuration.rb', line 82

def self.new
  jndi_context_builder = JNDI::ContextBuilder.new(configuration.jms_client_jar, configuration.jndi_properties)
  
  connection = Provider.new(configuration, jndi_context_builder)
end

.use_jms_client_jar(jms_client_jar) ⇒ Object

Example:

use_jms_client_jar “path/to/name_of_the_client_jar_file.jar”



34
35
36
# File 'lib/connection/configuration.rb', line 34

def use_jms_client_jar(jms_client_jar)
  configuration.jms_client_jar = jms_client_jar
end

.use_jndi_properties(jndi_properties = {}) ⇒ Object

Example:

use_jndi_properties :a_jndi_property_name_in_lower_case     => "a_value_of_property",
                    :other_jndi_property_name_in_lower_case => "other_value_of_property"


44
45
46
# File 'lib/connection/configuration.rb', line 44

def use_jndi_properties(jndi_properties = {})
  configuration.jndi_properties = jndi_properties
end