jruby-hornetq 0.2.0.alpha → 0.2.1.alpha
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/HISTORY.md +8 -0
- data/README.md +88 -5
- data/Rakefile +4 -4
- data/bin/hornetq_server +26 -55
- data/examples/{batch_client.rb → client/advanced/batch_client.rb} +11 -4
- data/examples/{client.rb → client/advanced/client.rb} +8 -10
- data/examples/{consumer.rb → client/advanced/consumer.rb} +2 -2
- data/examples/{hornetq.yml → client/advanced/hornetq.yml} +11 -10
- data/examples/{multi_client.rb → client/advanced/multi_client.rb} +6 -3
- data/examples/{multi_consumer.rb → client/advanced/multi_consumer.rb} +2 -2
- data/examples/{producer.rb → client/advanced/producer.rb} +3 -4
- data/examples/{server.rb → client/advanced/server.rb} +6 -9
- data/examples/client/client.rb +31 -0
- data/examples/client/consumer.rb +22 -0
- data/examples/client/invm.rb +38 -0
- data/examples/client/producer.rb +21 -0
- data/examples/client/server.rb +31 -0
- data/examples/server/backup_server.yml +6 -0
- data/examples/server/live_server.yml +1 -0
- data/examples/server/standalone_server.yml +1 -0
- data/lib/data/bindings/hornetq-bindings-1.bindings +0 -0
- data/lib/data/bindings/hornetq-bindings-2.bindings +0 -0
- data/lib/hornetq.rb +30 -9
- data/lib/hornetq/client.rb +19 -0
- data/lib/hornetq/{hornet_q_client.rb → client/factory.rb} +85 -88
- data/lib/hornetq/{org_hornetq_api_core_client_client_session.rb → client/org_hornetq_api_core_client_client_session.rb} +2 -2
- data/lib/hornetq/{org_hornetq_core_client_impl_client_message_impl.rb → client/org_hornetq_core_client_impl_client_message_impl.rb} +62 -2
- data/lib/hornetq/{org_hornetq_core_client_impl_client_producer_impl.rb → client/org_hornetq_core_client_impl_client_producer_impl.rb} +0 -0
- data/lib/hornetq/{org_hornetq_utils_typed_properties.rb → client/org_hornetq_utils_typed_properties.rb} +0 -0
- data/lib/hornetq/{client_requestor.rb → client/requestor.rb} +2 -2
- data/lib/hornetq/{client_server.rb → client/server.rb} +2 -2
- data/lib/hornetq/{session_pool.rb → client/session_pool.rb} +20 -20
- data/lib/hornetq/{lib → java}/hornetq-core-client.jar +0 -0
- data/lib/hornetq/{lib → java}/hornetq-core.jar +0 -0
- data/lib/hornetq/{lib → java}/netty.jar +0 -0
- data/lib/hornetq/org_hornetq_core_server_hornet_q_server.rb +13 -0
- data/lib/hornetq/server.rb +12 -0
- data/lib/hornetq/server/factory.rb +86 -0
- data/lib/hornetq/uri.rb +59 -0
- data/test/server_factory_test.rb +184 -0
- data/test/uri_test.rb +74 -0
- metadata +44 -28
- data/examples/backup_server.yml +0 -4
- data/examples/live_server.yml +0 -5
- data/examples/run_broker.rb +0 -59
- data/examples/standalone_server.yml +0 -3
data/test/uri_test.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'shoulda'
|
4
|
+
require 'hornetq'
|
5
|
+
|
6
|
+
class URITest < Test::Unit::TestCase
|
7
|
+
context '' do
|
8
|
+
setup do
|
9
|
+
end
|
10
|
+
|
11
|
+
should 'parse simple uri' do
|
12
|
+
uri = HornetQ::URI.new('hornetq://1.2.3.4')
|
13
|
+
assert_equal 'hornetq', uri.scheme
|
14
|
+
assert_equal '1.2.3.4', uri.host
|
15
|
+
assert_equal HornetQ::DEFAULT_NETTY_PORT, uri.port
|
16
|
+
assert_nil uri.backup_host
|
17
|
+
assert_equal '/', uri.path
|
18
|
+
assert_equal false, uri.backup?
|
19
|
+
end
|
20
|
+
|
21
|
+
should 'reject invalid scheme' do
|
22
|
+
e = assert_raises Exception do
|
23
|
+
HornetQ::URI.new('foo://1.2.3.4')
|
24
|
+
conn.fail_on(1,2)
|
25
|
+
end
|
26
|
+
assert_match %r%scheme%, e.message
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'parse with settings' do
|
30
|
+
uri = HornetQ::URI.new('hornetq://foobar:1234/zulu?data_directory=../abc&myval=def')
|
31
|
+
assert_equal 'hornetq', uri.scheme
|
32
|
+
assert_equal 'foobar', uri.host
|
33
|
+
assert_equal HornetQ.netty_port(1234), uri.port
|
34
|
+
assert_nil uri.backup_host
|
35
|
+
assert_equal '/zulu', uri.path
|
36
|
+
assert_equal '../abc', uri[:data_directory]
|
37
|
+
assert_equal false, uri.backup?
|
38
|
+
assert_equal 'def', uri[:myval]
|
39
|
+
end
|
40
|
+
|
41
|
+
should 'parse backup server' do
|
42
|
+
uri = HornetQ::URI.new('hornetq://0.0.0.0:5446/?backup=true&data_directory=./data_backup')
|
43
|
+
assert_equal 'hornetq', uri.scheme
|
44
|
+
assert_equal '0.0.0.0', uri.host
|
45
|
+
assert_equal HornetQ.netty_port(5446), uri.port
|
46
|
+
assert_nil uri.backup_host
|
47
|
+
assert_equal '/', uri.path
|
48
|
+
assert_equal './data_backup', uri[:data_directory]
|
49
|
+
assert_equal true, uri.backup?
|
50
|
+
end
|
51
|
+
|
52
|
+
should 'parse live server with backup specified' do
|
53
|
+
uri = HornetQ::URI.new('hornetq://0.0.0.0,hornetq_backup')
|
54
|
+
assert_equal 'hornetq', uri.scheme
|
55
|
+
assert_equal '0.0.0.0', uri.host
|
56
|
+
assert_equal HornetQ::DEFAULT_NETTY_PORT, uri.port
|
57
|
+
assert_equal 'hornetq_backup', uri.backup_host
|
58
|
+
assert_equal HornetQ::DEFAULT_NETTY_PORT, uri.backup_port
|
59
|
+
assert_equal '/', uri.path
|
60
|
+
assert_equal false, uri.backup?
|
61
|
+
end
|
62
|
+
|
63
|
+
should 'parse live server with backup and ports specified' do
|
64
|
+
uri = HornetQ::URI.new('hornetq://0.0.0.0:4321,hornetq_backup:4322')
|
65
|
+
assert_equal 'hornetq', uri.scheme
|
66
|
+
assert_equal '0.0.0.0', uri.host
|
67
|
+
assert_equal HornetQ.netty_port(4321), uri.port
|
68
|
+
assert_equal 'hornetq_backup', uri.backup_host
|
69
|
+
assert_equal HornetQ.netty_port(4322), uri.backup_port
|
70
|
+
assert_equal '/', uri.path
|
71
|
+
assert_equal false, uri.backup?
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -5,17 +5,18 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
8
|
+
- 1
|
9
9
|
- alpha
|
10
|
-
version: 0.2.
|
10
|
+
version: 0.2.1.alpha
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Reid Morrison
|
14
|
+
- Brad Pardee
|
14
15
|
autorequire:
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-01-
|
19
|
+
date: 2011-01-26 00:00:00 -05:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +34,9 @@ dependencies:
|
|
33
34
|
type: :runtime
|
34
35
|
version_requirements: *id001
|
35
36
|
description: JRuby-HornetQ is a Java and Ruby library that exposes the HornetQ Java API in a ruby friendly way. For JRuby only.
|
36
|
-
email:
|
37
|
+
email:
|
38
|
+
- rubywmq@gmail.com
|
39
|
+
- bpardee@gmail.com
|
37
40
|
executables: []
|
38
41
|
|
39
42
|
extensions: []
|
@@ -46,32 +49,45 @@ files:
|
|
46
49
|
- Rakefile
|
47
50
|
- README.md
|
48
51
|
- bin/hornetq_server
|
49
|
-
- examples/
|
50
|
-
- examples/
|
51
|
-
- examples/client.rb
|
52
|
-
- examples/
|
53
|
-
- examples/
|
54
|
-
- examples/
|
55
|
-
- examples/
|
56
|
-
- examples/
|
57
|
-
- examples/
|
58
|
-
- examples/
|
59
|
-
- examples/
|
60
|
-
- examples/
|
52
|
+
- examples/client/client.rb
|
53
|
+
- examples/client/consumer.rb
|
54
|
+
- examples/client/invm.rb
|
55
|
+
- examples/client/producer.rb
|
56
|
+
- examples/client/server.rb
|
57
|
+
- examples/client/advanced/batch_client.rb
|
58
|
+
- examples/client/advanced/client.rb
|
59
|
+
- examples/client/advanced/consumer.rb
|
60
|
+
- examples/client/advanced/hornetq.yml
|
61
|
+
- examples/client/advanced/multi_client.rb
|
62
|
+
- examples/client/advanced/multi_consumer.rb
|
63
|
+
- examples/client/advanced/producer.rb
|
64
|
+
- examples/client/advanced/server.rb
|
65
|
+
- examples/server/backup_server.yml
|
66
|
+
- examples/server/live_server.yml
|
67
|
+
- examples/server/standalone_server.yml
|
61
68
|
- lib/hornetq.rb
|
62
|
-
- lib/hornetq
|
63
|
-
- lib/hornetq
|
64
|
-
- lib/hornetq/
|
65
|
-
- lib/hornetq/
|
66
|
-
- lib/hornetq/
|
67
|
-
- lib/hornetq/
|
68
|
-
- lib/hornetq/
|
69
|
-
- lib/hornetq/
|
70
|
-
- lib/hornetq/
|
71
|
-
- lib/hornetq/
|
72
|
-
- lib/hornetq/
|
69
|
+
- lib/data/bindings/hornetq-bindings-1.bindings
|
70
|
+
- lib/data/bindings/hornetq-bindings-2.bindings
|
71
|
+
- lib/hornetq/client.rb
|
72
|
+
- lib/hornetq/org_hornetq_core_server_hornet_q_server.rb
|
73
|
+
- lib/hornetq/server.rb
|
74
|
+
- lib/hornetq/uri.rb
|
75
|
+
- lib/hornetq/client/factory.rb
|
76
|
+
- lib/hornetq/client/org_hornetq_api_core_client_client_session.rb
|
77
|
+
- lib/hornetq/client/org_hornetq_core_client_impl_client_message_impl.rb
|
78
|
+
- lib/hornetq/client/org_hornetq_core_client_impl_client_producer_impl.rb
|
79
|
+
- lib/hornetq/client/org_hornetq_utils_typed_properties.rb
|
80
|
+
- lib/hornetq/client/requestor.rb
|
81
|
+
- lib/hornetq/client/server.rb
|
82
|
+
- lib/hornetq/client/session_pool.rb
|
83
|
+
- lib/hornetq/java/hornetq-core-client.jar
|
84
|
+
- lib/hornetq/java/hornetq-core.jar
|
85
|
+
- lib/hornetq/java/netty.jar
|
86
|
+
- lib/hornetq/server/factory.rb
|
87
|
+
- test/server_factory_test.rb
|
88
|
+
- test/uri_test.rb
|
73
89
|
has_rdoc: true
|
74
|
-
homepage:
|
90
|
+
homepage: https://github.com/ClarityServices/jruby-hornetq
|
75
91
|
licenses: []
|
76
92
|
|
77
93
|
post_install_message:
|
data/examples/backup_server.yml
DELETED
data/examples/live_server.yml
DELETED
data/examples/run_broker.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
#!/usr/bin/env jruby
|
2
|
-
|
3
|
-
raise 'Environment variable HORNETQ_HOME not set' unless ENV['HORNETQ_HOME']
|
4
|
-
require "#{ENV['HORNETQ_HOME']}/lib/hornetq-core.jar"
|
5
|
-
require "#{ENV['HORNETQ_HOME']}/lib/netty.jar"
|
6
|
-
|
7
|
-
backup_host = ARGV[0]
|
8
|
-
is_backup = backup_host.nil?
|
9
|
-
|
10
|
-
config = Java::org.hornetq.core.config.impl.ConfigurationImpl.new
|
11
|
-
config.persistence_enabled = false
|
12
|
-
config.security_enabled = false
|
13
|
-
config.paging_directory = '../data/paging'
|
14
|
-
config.bindings_directory = '../data/bindings'
|
15
|
-
config.journal_directory = '../data/journal'
|
16
|
-
config.journal_min_files = 10
|
17
|
-
config.large_messages_directory = '../data/large-messages'
|
18
|
-
|
19
|
-
if Java::org.hornetq.core.journal.impl.AIOSequentialFileFactory.isSupported
|
20
|
-
config.journal_type = Java::org.hornetq.core.server.JournalType::ASYNCIO
|
21
|
-
else
|
22
|
-
puts("AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal");
|
23
|
-
config.journal_type = Java::org.hornetq.core.server.JournalType::NIO
|
24
|
-
end
|
25
|
-
|
26
|
-
netty_acceptor_class_name = Java::org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory.java_class.name
|
27
|
-
netty_connector_class_name = Java::org.hornetq.core.remoting.impl.netty.NettyConnectorFactory.java_class.name
|
28
|
-
|
29
|
-
transport_conf_params = java.util.HashMap.new
|
30
|
-
transport_conf_params.put('host', '0.0.0.0')
|
31
|
-
transport_conf_params.put('port', 5445)
|
32
|
-
transport_conf = Java::org.hornetq.api.core.TransportConfiguration.new(netty_acceptor_class_name, transport_conf_params);
|
33
|
-
|
34
|
-
transport_conf_set = java.util.HashSet.new
|
35
|
-
transport_conf_set.add(transport_conf)
|
36
|
-
|
37
|
-
config.acceptor_configurations = transport_conf_set
|
38
|
-
|
39
|
-
if is_backup
|
40
|
-
puts "backup"
|
41
|
-
config.backup = true
|
42
|
-
config.shared_store = false
|
43
|
-
else
|
44
|
-
puts "live"
|
45
|
-
backup_params = java.util.HashMap.new
|
46
|
-
backup_params.put('host', backup_host)
|
47
|
-
backup_params.put('port', 5445)
|
48
|
-
#backup_params.put('reconnectAttempts', -1)
|
49
|
-
backup_connector_conf = Java::org.hornetq.api.core.TransportConfiguration.new(netty_connector_class_name, backup_params);
|
50
|
-
|
51
|
-
connector_conf_map = java.util.HashMap.new
|
52
|
-
connector_conf_map.put('backup-connector', backup_connector_conf)
|
53
|
-
|
54
|
-
config.connector_configurations = connector_conf_map
|
55
|
-
config.backup_connector_name = 'backup-connector'
|
56
|
-
end
|
57
|
-
|
58
|
-
server = Java::org.hornetq.core.server.HornetQServers.newHornetQServer(config)
|
59
|
-
server.start
|