Class: TorqueBox::Messaging::XaConnectionFactory
- Inherits:
-
Object
- Object
- TorqueBox::Messaging::XaConnectionFactory
- Defined in:
- lib/torquebox/messaging/xa_connection_factory.rb
Instance Attribute Summary collapse
-
#internal_connection_factory ⇒ Object
readonly
Returns the value of attribute internal_connection_factory.
Class Method Summary collapse
Instance Method Summary collapse
- #create_connection ⇒ Object
-
#initialize(internal_connection_factory = nil) ⇒ XaConnectionFactory
constructor
A new instance of XaConnectionFactory.
- #to_s ⇒ Object
- #with_new_connection(options, &block) ⇒ Object
Constructor Details
#initialize(internal_connection_factory = nil) ⇒ XaConnectionFactory
Returns a new instance of XaConnectionFactory.
32 33 34 |
# File 'lib/torquebox/messaging/xa_connection_factory.rb', line 32 def initialize(internal_connection_factory = nil) @internal_connection_factory = internal_connection_factory end |
Instance Attribute Details
#internal_connection_factory ⇒ Object (readonly)
Returns the value of attribute internal_connection_factory.
25 26 27 |
# File 'lib/torquebox/messaging/xa_connection_factory.rb', line 25 def internal_connection_factory @internal_connection_factory end |
Class Method Details
.new(internal_connection_factory = nil) ⇒ Object
27 28 29 30 |
# File 'lib/torquebox/messaging/xa_connection_factory.rb', line 27 def self.new(internal_connection_factory = nil) return internal_connection_factory if internal_connection_factory.is_a?( XaConnectionFactory ) super end |
Instance Method Details
#create_connection ⇒ Object
49 50 51 |
# File 'lib/torquebox/messaging/xa_connection_factory.rb', line 49 def create_connection() XaConnection.new( @internal_connection_factory.create_xa_connection ) end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/torquebox/messaging/xa_connection_factory.rb', line 54 def to_s "[XaConnectionFactory: internal_connection_factory=#{internal_connection_factory}]" end |
#with_new_connection(options, &block) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/torquebox/messaging/xa_connection_factory.rb', line 36 def with_new_connection(, &block) client_id = [:client_id] connection = create_connection connection.client_id = client_id connection.start begin result = block.call( connection ) ensure connection.close end return result end |