torquebox-messaging 2.0.0.beta2-java → 2.0.0.beta3-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/hornetq-core-2.2.10.Final.jar +0 -0
- data/lib/hornetq-jms-2.2.10.Final.jar +0 -0
- data/lib/jboss-jms-api_1.1_spec-1.0.0.Final.jar +0 -0
- data/lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar +0 -0
- data/lib/netty-3.2.6.Final.jar +0 -0
- data/lib/torquebox/messaging/connection_factory.rb +9 -7
- data/lib/torquebox/messaging/destination.rb +15 -10
- data/lib/torquebox/messaging/xa_connection_factory.rb +2 -1
- data/lib/torquebox-messaging.jar +0 -0
- data/lib/torquebox-messaging.rb +7 -2
- data/spec/destination_spec.rb +24 -0
- metadata +9 -4
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -33,9 +33,10 @@ module TorqueBox
|
|
33
33
|
@internal_connection_factory = internal_connection_factory
|
34
34
|
end
|
35
35
|
|
36
|
-
def with_new_connection(
|
37
|
-
|
38
|
-
connection
|
36
|
+
def with_new_connection(options, &block)
|
37
|
+
client_id = options[:client_id]
|
38
|
+
connection = create_connection( options[:naming_host], options[:naming_port] )
|
39
|
+
connection.client_id = client_id if client_id
|
39
40
|
connection.start
|
40
41
|
begin
|
41
42
|
result = block.call( connection )
|
@@ -45,11 +46,12 @@ module TorqueBox
|
|
45
46
|
return result
|
46
47
|
end
|
47
48
|
|
48
|
-
def create_connection()
|
49
|
+
def create_connection(host, port)
|
50
|
+
host ||= "localhost"
|
51
|
+
port ||= 5445
|
49
52
|
if !@internal_connection_factory
|
50
|
-
# try to connect to HornetQ directly
|
51
|
-
|
52
|
-
connect_opts = { org.hornetq.core.remoting.impl.netty.TransportConstants::PORT_PROP_NAME => 5445.to_java( java.lang.Integer ) }
|
53
|
+
# try to connect to HornetQ directly
|
54
|
+
connect_opts = { "host" => host, "port" => port }
|
53
55
|
transport_config =
|
54
56
|
org.hornetq.api.core.TransportConfiguration.new("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory",
|
55
57
|
connect_opts)
|
@@ -32,10 +32,10 @@ module TorqueBox
|
|
32
32
|
attr_accessor :connect_options
|
33
33
|
|
34
34
|
PRIORITY_MAP = {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
:low => 1,
|
36
|
+
:normal => 4,
|
37
|
+
:high => 7,
|
38
|
+
:critical => 9
|
39
39
|
}
|
40
40
|
|
41
41
|
def _dump(depth)
|
@@ -44,13 +44,18 @@ module TorqueBox
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def self._load(str)
|
47
|
-
|
47
|
+
self.new( str )
|
48
48
|
end
|
49
49
|
|
50
|
-
def initialize(destination,
|
50
|
+
def initialize(destination, connection_factory_or_options = nil)
|
51
|
+
if connection_factory_or_options.nil? || connection_factory_or_options.is_a?( Hash )
|
52
|
+
@connection_factory = ConnectionFactory.new( __inject__( 'connection-factory' ) )
|
53
|
+
@connect_options = connection_factory_or_options || {}
|
54
|
+
else
|
55
|
+
@connection_factory = ConnectionFactory.new( connection_factory_or_options )
|
56
|
+
@connect_options = {}
|
57
|
+
end
|
51
58
|
@name = destination
|
52
|
-
@connection_factory = ConnectionFactory.new( connection_factory )
|
53
|
-
@connect_options = {}
|
54
59
|
@enumerable_options = {}
|
55
60
|
end
|
56
61
|
|
@@ -86,7 +91,7 @@ module TorqueBox
|
|
86
91
|
|
87
92
|
def with_session(opts = {})
|
88
93
|
transactional = opts.fetch(:tx, true)
|
89
|
-
connection_factory.with_new_connection( connect_options
|
94
|
+
connection_factory.with_new_connection( connect_options ) do |connection|
|
90
95
|
connection.with_session(transactional) do |session|
|
91
96
|
yield session
|
92
97
|
end
|
@@ -119,7 +124,7 @@ module TorqueBox
|
|
119
124
|
if PRIORITY_MAP[options[:priority]]
|
120
125
|
options[:priority] = PRIORITY_MAP[options[:priority]]
|
121
126
|
elsif (0..9) === options[:priority].to_i
|
122
|
-
|
127
|
+
options[:priority] = options[:priority].to_i
|
123
128
|
else
|
124
129
|
raise ArgumentError.new(":priority must in the range 0..9, or one of #{PRIORITY_MAP.keys.collect {|k| ":#{k}"}.join(',')}")
|
125
130
|
end
|
@@ -33,7 +33,8 @@ module TorqueBox
|
|
33
33
|
@internal_connection_factory = internal_connection_factory
|
34
34
|
end
|
35
35
|
|
36
|
-
def with_new_connection(
|
36
|
+
def with_new_connection(options, &block)
|
37
|
+
client_id = options[:client_id]
|
37
38
|
connection = create_connection
|
38
39
|
connection.client_id = client_id
|
39
40
|
connection.start
|
data/lib/torquebox-messaging.jar
CHANGED
Binary file
|
data/lib/torquebox-messaging.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
module TorqueboxMessaging
|
2
|
-
VERSION = '2.0.0.
|
3
|
-
MAVEN_VERSION = '2.0.0.
|
2
|
+
VERSION = '2.0.0.beta3'
|
3
|
+
MAVEN_VERSION = '2.0.0.beta3'
|
4
4
|
end
|
5
5
|
begin
|
6
6
|
require 'java'
|
7
7
|
require File.dirname(__FILE__) + '/torquebox-messaging.jar'
|
8
|
+
require File.dirname(__FILE__) + '/jboss-jms-api_1.1_spec-1.0.0.Final.jar'
|
9
|
+
require File.dirname(__FILE__) + '/jboss-transaction-api_1.1_spec-1.0.0.Final.jar'
|
10
|
+
require File.dirname(__FILE__) + '/hornetq-core-2.2.10.Final.jar'
|
11
|
+
require File.dirname(__FILE__) + '/hornetq-jms-2.2.10.Final.jar'
|
12
|
+
require File.dirname(__FILE__) + '/netty-3.2.6.Final.jar'
|
8
13
|
rescue LoadError
|
9
14
|
puts 'JAR-based gems require JRuby to load. Please visit www.jruby.org.'
|
10
15
|
raise
|
data/spec/destination_spec.rb
CHANGED
@@ -17,6 +17,30 @@ describe TorqueBox::Messaging::Destination do
|
|
17
17
|
topic.name.should == "/topics/bar"
|
18
18
|
end
|
19
19
|
|
20
|
+
it "should fall back to internal connection factory" do
|
21
|
+
factory = Object.new
|
22
|
+
TorqueBox::Registry.merge!("connection-factory" => factory)
|
23
|
+
queue = TorqueBox::Messaging::Queue.new("/queues/foo")
|
24
|
+
queue.connection_factory.internal_connection_factory.should == factory
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should initialize with connection factory if given" do
|
28
|
+
factory = Object.new
|
29
|
+
queue = TorqueBox::Messaging::Queue.new("/queues/foo", factory)
|
30
|
+
queue.connection_factory.internal_connection_factory.should == factory
|
31
|
+
queue.connect_options.should be_empty
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should default to no connect options" do
|
35
|
+
queue = TorqueBox::Messaging::Queue.new("/queues/foo")
|
36
|
+
queue.connect_options.should be_empty
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should initialize with connect options if given" do
|
40
|
+
queue = TorqueBox::Messaging::Queue.new("/queues/foo", :naming_host => "bart")
|
41
|
+
queue.connect_options[:naming_host].should == "bart"
|
42
|
+
end
|
43
|
+
|
20
44
|
it "should start and stop a queue" do
|
21
45
|
server = Mockito.mock(JMSServerManagerImpl.java_class)
|
22
46
|
TorqueBox::ServiceRegistry.stub!(:lookup).with("jboss.messaging.default.jms.manager").and_yield(server)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: torquebox-messaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 2.0.0.
|
5
|
+
version: 2.0.0.beta3
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- The TorqueBox Team
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-01-
|
13
|
+
date: 2012-01-24 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: torquebox-core
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.0.0.
|
23
|
+
version: 2.0.0.beta3
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 2.0.0.
|
34
|
+
version: 2.0.0.beta3
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id002
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -58,6 +58,11 @@ files:
|
|
58
58
|
- licenses/lgpl-2.1.txt
|
59
59
|
- lib/torquebox-messaging.jar
|
60
60
|
- lib/torquebox-messaging.rb
|
61
|
+
- lib/jboss-jms-api_1.1_spec-1.0.0.Final.jar
|
62
|
+
- lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar
|
63
|
+
- lib/hornetq-core-2.2.10.Final.jar
|
64
|
+
- lib/hornetq-jms-2.2.10.Final.jar
|
65
|
+
- lib/netty-3.2.6.Final.jar
|
61
66
|
- lib/gem_hook.rb
|
62
67
|
- lib/org.torquebox.messaging-client.rb
|
63
68
|
- lib/torquebox/messaging.rb
|