Module: JSparrow::Connection

Defined in:
lib/client.rb,
lib/listener.rb,
lib/connection.rb

Defined Under Namespace

Classes: Base, Client, Configuration, InitializationError, InvalidStateError, Listener

Class Method Summary collapse

Class Method Details

.configurationObject

Metodo usado para obter a configuracao para conexao com o provedor de JMS.



23
24
25
# File 'lib/connection.rb', line 23

def configuration
  @@configuration
end

.configure(&block) ⇒ Object

Metodo usado para configurar a conexao.



12
13
14
15
16
17
18
# File 'lib/connection.rb', line 12

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

.enable_connection_factories(jndi_names = {}) ⇒ Object

Use:

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


52
53
54
# File 'lib/connection.rb', line 52

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

.enable_queues(jndi_names = {}) ⇒ Object

Use:

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


62
63
64
# File 'lib/connection.rb', line 62

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

.enable_topics(jndi_names = {}) ⇒ Object

Use:

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


72
73
74
# File 'lib/connection.rb', line 72

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

.new_clientObject

Metodo usado para criar um novo Client JMS.



79
80
81
# File 'lib/connection.rb', line 79

def new_client
  Client.new(new_connection)
end

.new_listener(listener_spec) ⇒ Object

Metodo usado para criar um novo Listener de mensagens JMS.



86
87
88
# File 'lib/connection.rb', line 86

def new_listener(listener_spec)
  listener_spec[:as].new(new_connection)
end

.use_jms_client_jar(client_jar) ⇒ Object

Use:

use_jms_client_jar “path/to/name_of_the_client_jar_file.jar”



32
33
34
# File 'lib/connection.rb', line 32

def use_jms_client_jar(client_jar)
  configuration.jms_client_jar = client_jar
end

.use_jndi_properties(jndi_properties = {}) ⇒ Object

Use:

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"


42
43
44
# File 'lib/connection.rb', line 42

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