jruby-jms 1.1.0-java → 1.2.0-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.
- checksums.yaml +4 -4
- data/HISTORY.md +24 -7
- data/README.md +49 -49
- data/Rakefile +17 -12
- data/lib/jms.rb +8 -17
- data/lib/jms/bytes_message.rb +3 -19
- data/lib/jms/connection.rb +63 -83
- data/lib/jms/map_message.rb +9 -25
- data/lib/jms/message.rb +22 -173
- data/lib/jms/message_consumer.rb +23 -35
- data/lib/jms/message_listener_impl.rb +22 -38
- data/lib/jms/message_producer.rb +9 -25
- data/lib/jms/mq_workaround.rb +11 -26
- data/lib/jms/object_message.rb +1 -17
- data/lib/jms/oracle_a_q_connection_factory.rb +4 -21
- data/lib/jms/queue_browser.rb +2 -18
- data/lib/jms/session.rb +92 -106
- data/lib/jms/session_pool.rb +34 -41
- data/lib/jms/text_message.rb +0 -16
- data/lib/jms/version.rb +1 -1
- data/test/connection_test.rb +35 -81
- data/test/jms.yml +18 -8
- data/test/message_test.rb +27 -43
- data/test/session_pool_test.rb +30 -46
- data/test/session_test.rb +30 -45
- data/test/test_helper.rb +33 -0
- metadata +20 -26
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -36
- data/examples/advanced/session_pool.rb +0 -37
- data/examples/client-server/replier.rb +0 -29
- data/examples/client-server/requestor.rb +0 -40
- data/examples/file-to-q/files_to_q.rb +0 -51
- data/examples/file-to-q/q_to_files.rb +0 -44
- data/examples/invm/invm.rb +0 -44
- data/examples/invm/log4j.properties +0 -58
- data/examples/jms.yml +0 -149
- data/examples/performance/consumer.rb +0 -25
- data/examples/performance/producer.rb +0 -31
- data/examples/producer-consumer/browser.rb +0 -24
- data/examples/producer-consumer/consumer.rb +0 -24
- data/examples/producer-consumer/consumer_async.rb +0 -41
- data/examples/producer-consumer/producer.rb +0 -25
- data/examples/publish-subscribe/publish.rb +0 -24
- data/examples/publish-subscribe/subscribe.rb +0 -31
- data/lib/jms/logging.rb +0 -50
- data/nbproject/private/private.properties +0 -3
- data/nbproject/private/rake-d.txt +0 -5
- data/parallel_minion.gemspec +0 -21
data/test/session_pool_test.rb
CHANGED
@@ -1,65 +1,49 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative 'test_helper'
|
2
|
+
require 'timeout'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
context 'JMS Session' do
|
12
|
-
# Load configuration from jms.yml
|
13
|
-
setup do
|
14
|
-
# To change the JMS provider, edit jms.yml and change :default
|
15
|
-
|
16
|
-
# Load Connection parameters from configuration file
|
17
|
-
cfg = YAML.load_file(File.join(File.dirname(__FILE__), 'jms.yml'))
|
18
|
-
jms_provider = cfg['default']
|
19
|
-
@config = cfg[jms_provider]
|
20
|
-
raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless @config
|
21
|
-
@queue_name = @config.delete(:queue_name) || raise("Mandatory :queue_name missing from jms.yml")
|
22
|
-
@topic_name = @config.delete(:topic_name) || raise("Mandatory :topic_name missing from jms.yml")
|
23
|
-
@pool_params = {
|
24
|
-
:pool_name => 'Test::JMS::SessionPool',
|
25
|
-
:pool_size => 10,
|
26
|
-
:pool_warn_timeout => 5.0,
|
27
|
-
#:pool_logger =>
|
4
|
+
class SessionPoolTest < Minitest::Test
|
5
|
+
describe JMS::SessionPool do
|
6
|
+
before do
|
7
|
+
@config, @queue_name, @topic_name = read_config
|
8
|
+
@pool_params = {
|
9
|
+
pool_size: 10,
|
10
|
+
pool_warn_timeout: 5.0
|
28
11
|
}
|
29
12
|
end
|
30
13
|
|
31
|
-
|
14
|
+
it 'create a session pool' do
|
32
15
|
JMS::Connection.start(@config) do |connection|
|
33
16
|
pool = connection.create_session_pool(@pool_params)
|
34
17
|
pool.session do |session|
|
35
|
-
|
18
|
+
assert session
|
36
19
|
assert session.is_a?(javax.jms.Session)
|
37
20
|
end
|
38
21
|
pool.close
|
39
22
|
end
|
40
23
|
end
|
41
24
|
|
42
|
-
|
25
|
+
it 'remove bad session from pool' do
|
43
26
|
JMS::Connection.start(@config) do |connection|
|
44
|
-
pool = connection.create_session_pool(@pool_params.merge(:
|
45
|
-
s
|
46
|
-
r
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
27
|
+
pool = connection.create_session_pool(@pool_params.merge(pool_size: 1))
|
28
|
+
s = nil
|
29
|
+
r =
|
30
|
+
begin
|
31
|
+
pool.session do |session|
|
32
|
+
assert session
|
33
|
+
assert session.is_a?(javax.jms.Session)
|
34
|
+
s = session
|
35
|
+
s.close
|
36
|
+
s.create_map_message
|
37
|
+
false
|
38
|
+
end
|
39
|
+
rescue javax.jms.IllegalStateException
|
40
|
+
true
|
54
41
|
end
|
55
|
-
rescue javax.jms.IllegalStateException
|
56
|
-
true
|
57
|
-
end
|
58
42
|
assert r == true
|
59
43
|
|
60
44
|
# Now verify that the previous closed session was removed from the pool
|
61
45
|
pool.session do |session|
|
62
|
-
|
46
|
+
assert session
|
63
47
|
assert session.is_a?(javax.jms.Session)
|
64
48
|
assert s != session
|
65
49
|
session.create_map_message
|
@@ -67,14 +51,14 @@ class JMSTest < Test::Unit::TestCase
|
|
67
51
|
end
|
68
52
|
end
|
69
53
|
|
70
|
-
|
54
|
+
it 'allow multiple sessions to be used concurrently' do
|
71
55
|
JMS::Connection.start(@config) do |connection|
|
72
56
|
pool = connection.create_session_pool(@pool_params)
|
73
57
|
pool.session do |session|
|
74
|
-
|
58
|
+
assert session
|
75
59
|
assert session.is_a?(javax.jms.Session)
|
76
60
|
pool.session do |session2|
|
77
|
-
|
61
|
+
assert session2
|
78
62
|
assert session2.is_a?(javax.jms.Session)
|
79
63
|
assert session != session2
|
80
64
|
end
|
data/test/session_test.rb
CHANGED
@@ -1,47 +1,32 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'test/unit'
|
6
|
-
require 'shoulda'
|
7
|
-
require 'jms'
|
1
|
+
require_relative 'test_helper'
|
8
2
|
require 'yaml'
|
9
3
|
|
10
|
-
class
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# To change the JMS provider, edit jms.yml and change :default
|
15
|
-
|
16
|
-
# Load Connection parameters from configuration file
|
17
|
-
cfg = YAML.load_file(File.join(File.dirname(__FILE__), 'jms.yml'))
|
18
|
-
jms_provider = cfg['default']
|
19
|
-
@config = cfg[jms_provider]
|
20
|
-
raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless @config
|
21
|
-
@queue_name = @config.delete(:queue_name) || raise("Mandatory :queue_name missing from jms.yml")
|
22
|
-
@topic_name = @config.delete(:topic_name) || raise("Mandatory :topic_name missing from jms.yml")
|
4
|
+
class SessionTest < Minitest::Test
|
5
|
+
describe 'JMS::Session' do
|
6
|
+
before do
|
7
|
+
@config, @queue_name, @topic_name = read_config
|
23
8
|
end
|
24
9
|
|
25
|
-
|
10
|
+
it 'create a session' do
|
26
11
|
JMS::Connection.session(@config) do |session|
|
27
|
-
|
12
|
+
assert session
|
28
13
|
end
|
29
14
|
end
|
30
15
|
|
31
|
-
|
16
|
+
it 'create automatic messages' do
|
32
17
|
JMS::Connection.session(@config) do |session|
|
33
|
-
|
18
|
+
assert session
|
34
19
|
# Create Text Message
|
35
20
|
assert_equal session.message("Hello").java_kind_of?(JMS::TextMessage), true
|
36
21
|
|
37
22
|
# Create Map Message
|
38
|
-
assert_equal session.message('hello'=>'world').java_kind_of?(JMS::MapMessage), true
|
23
|
+
assert_equal session.message('hello' => 'world').java_kind_of?(JMS::MapMessage), true
|
39
24
|
end
|
40
25
|
end
|
41
26
|
|
42
|
-
|
27
|
+
it 'create explicit messages' do
|
43
28
|
JMS::Connection.session(@config) do |session|
|
44
|
-
|
29
|
+
assert session
|
45
30
|
# Create Text Message
|
46
31
|
assert_equal session.create_text_message("Hello").java_kind_of?(JMS::TextMessage), true
|
47
32
|
|
@@ -50,71 +35,71 @@ class JMSTest < Test::Unit::TestCase
|
|
50
35
|
end
|
51
36
|
end
|
52
37
|
|
53
|
-
|
38
|
+
it 'create temporary destinations in blocks' do
|
54
39
|
JMS::Connection.session(@config) do |session|
|
55
|
-
|
40
|
+
assert session
|
56
41
|
|
57
42
|
# Temporary Queue
|
58
|
-
session.destination(:
|
43
|
+
session.destination(queue_name: :temporary) do |destination|
|
59
44
|
assert_equal destination.java_kind_of?(JMS::TemporaryQueue), true
|
60
45
|
end
|
61
46
|
|
62
47
|
# Temporary Topic
|
63
|
-
session.create_destination(:
|
48
|
+
session.create_destination(topic_name: :temporary) do |destination|
|
64
49
|
assert_equal destination.java_kind_of?(JMS::TemporaryTopic), true
|
65
50
|
end
|
66
51
|
end
|
67
52
|
end
|
68
53
|
|
69
|
-
|
54
|
+
it 'create temporary destinations' do
|
70
55
|
JMS::Connection.session(@config) do |session|
|
71
|
-
|
56
|
+
assert session
|
72
57
|
|
73
58
|
# Temporary Queue
|
74
|
-
destination = session.create_destination(:
|
59
|
+
destination = session.create_destination(queue_name: :temporary)
|
75
60
|
assert_equal destination.java_kind_of?(JMS::TemporaryQueue), true
|
76
61
|
destination.delete
|
77
62
|
|
78
63
|
# Temporary Topic
|
79
|
-
destination = session.create_destination(:
|
64
|
+
destination = session.create_destination(topic_name: :temporary)
|
80
65
|
assert_equal destination.java_kind_of?(JMS::TemporaryTopic), true
|
81
66
|
destination.delete
|
82
67
|
end
|
83
68
|
end
|
84
69
|
|
85
|
-
|
70
|
+
it 'create destinations in blocks' do
|
86
71
|
JMS::Connection.session(@config) do |session|
|
87
|
-
|
72
|
+
assert session
|
88
73
|
|
89
74
|
# Temporary Queue
|
90
|
-
session.destination(:
|
75
|
+
session.destination(queue_name: @queue_name) do |destination|
|
91
76
|
assert_equal destination.java_kind_of?(JMS::Queue), true
|
92
77
|
end
|
93
78
|
|
94
79
|
# Temporary Topic
|
95
|
-
session.create_destination(:
|
80
|
+
session.create_destination(topic_name: @topic_name) do |destination|
|
96
81
|
assert_equal destination.java_kind_of?(JMS::Topic), true
|
97
82
|
end
|
98
83
|
end
|
99
84
|
end
|
100
85
|
|
101
|
-
|
86
|
+
it 'create destinations' do
|
102
87
|
JMS::Connection.session(@config) do |session|
|
103
|
-
|
88
|
+
assert session
|
104
89
|
|
105
90
|
# Queue
|
106
|
-
queue = session.create_destination(:
|
91
|
+
queue = session.create_destination(queue_name: @queue_name)
|
107
92
|
assert_equal queue.java_kind_of?(JMS::Queue), true
|
108
93
|
|
109
94
|
# Topic
|
110
|
-
topic = session.create_destination(:
|
95
|
+
topic = session.create_destination(topic_name: @topic_name)
|
111
96
|
assert_equal topic.java_kind_of?(JMS::Topic), true
|
112
97
|
end
|
113
98
|
end
|
114
99
|
|
115
|
-
|
100
|
+
it 'create destinations using direct methods' do
|
116
101
|
JMS::Connection.session(@config) do |session|
|
117
|
-
|
102
|
+
assert session
|
118
103
|
|
119
104
|
# Queue
|
120
105
|
queue = session.queue(@queue_name)
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Allow test to be run in-place without requiring a gem install
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
3
|
+
|
4
|
+
# Configure Rails Environment
|
5
|
+
ENV['RAILS_ENV'] = 'test'
|
6
|
+
|
7
|
+
require 'minitest/autorun'
|
8
|
+
require 'minitest/reporters'
|
9
|
+
require 'yaml'
|
10
|
+
require 'jms'
|
11
|
+
|
12
|
+
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
13
|
+
|
14
|
+
SemanticLogger.add_appender('test.log', &SemanticLogger::Appender::Base.colorized_formatter)
|
15
|
+
SemanticLogger.default_level = :trace
|
16
|
+
|
17
|
+
# Set Log4J properties file so that it does not need to be in the CLASSPATH
|
18
|
+
java.lang.System.properties['log4j.configuration'] = 'test/log4j.properties'
|
19
|
+
|
20
|
+
# Load configuration from jms.yml
|
21
|
+
# Returns [Hash, String, String] the configuration, queue_name and topic_name
|
22
|
+
def read_config
|
23
|
+
# To change the JMS provider, edit jms.yml and change :default
|
24
|
+
|
25
|
+
# Load Connection parameters from configuration file
|
26
|
+
cfg = YAML.load_file(File.join(File.dirname(__FILE__), 'jms.yml'))
|
27
|
+
jms_provider = cfg['default']
|
28
|
+
config = cfg[jms_provider]
|
29
|
+
raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless config
|
30
|
+
queue_name = config.delete(:queue_name) || raise("Mandatory :queue_name missing from jms.yml")
|
31
|
+
topic_name = config.delete(:topic_name) || raise("Mandatory :topic_name missing from jms.yml")
|
32
|
+
[config, queue_name, topic_name]
|
33
|
+
end
|
metadata
CHANGED
@@ -1,63 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-jms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - '>='
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '0'
|
14
19
|
name: gene_pool
|
20
|
+
prerelease: false
|
21
|
+
type: :runtime
|
15
22
|
version_requirements: !ruby/object:Gem::Requirement
|
16
23
|
requirements:
|
17
24
|
- - '>='
|
18
25
|
- !ruby/object:Gem::Version
|
19
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
20
28
|
requirement: !ruby/object:Gem::Requirement
|
21
29
|
requirements:
|
22
30
|
- - '>='
|
23
31
|
- !ruby/object:Gem::Version
|
24
32
|
version: '0'
|
33
|
+
name: semantic_logger
|
25
34
|
prerelease: false
|
26
35
|
type: :runtime
|
27
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: jruby-jms is a complete JRuby API into Java Messaging Specification (JMS) V1.1. For JRuby only.
|
28
42
|
email:
|
29
43
|
- reidmo@gmail.com
|
30
44
|
executables: []
|
31
45
|
extensions: []
|
32
46
|
extra_rdoc_files: []
|
33
47
|
files:
|
34
|
-
- Gemfile
|
35
|
-
- Gemfile.lock
|
36
48
|
- HISTORY.md
|
37
49
|
- LICENSE.txt
|
38
50
|
- README.md
|
39
51
|
- Rakefile
|
40
|
-
- examples/advanced/session_pool.rb
|
41
|
-
- examples/client-server/replier.rb
|
42
|
-
- examples/client-server/requestor.rb
|
43
|
-
- examples/file-to-q/files_to_q.rb
|
44
|
-
- examples/file-to-q/q_to_files.rb
|
45
|
-
- examples/invm/invm.rb
|
46
|
-
- examples/invm/log4j.properties
|
47
|
-
- examples/jms.yml
|
48
|
-
- examples/performance/consumer.rb
|
49
|
-
- examples/performance/producer.rb
|
50
|
-
- examples/producer-consumer/browser.rb
|
51
|
-
- examples/producer-consumer/consumer.rb
|
52
|
-
- examples/producer-consumer/consumer_async.rb
|
53
|
-
- examples/producer-consumer/producer.rb
|
54
|
-
- examples/publish-subscribe/publish.rb
|
55
|
-
- examples/publish-subscribe/subscribe.rb
|
56
52
|
- lib/jms.rb
|
57
53
|
- lib/jms/bytes_message.rb
|
58
54
|
- lib/jms/connection.rb
|
59
55
|
- lib/jms/imports.rb
|
60
|
-
- lib/jms/logging.rb
|
61
56
|
- lib/jms/map_message.rb
|
62
57
|
- lib/jms/message.rb
|
63
58
|
- lib/jms/message_consumer.rb
|
@@ -71,15 +66,13 @@ files:
|
|
71
66
|
- lib/jms/session_pool.rb
|
72
67
|
- lib/jms/text_message.rb
|
73
68
|
- lib/jms/version.rb
|
74
|
-
- nbproject/private/private.properties
|
75
|
-
- nbproject/private/rake-d.txt
|
76
|
-
- parallel_minion.gemspec
|
77
69
|
- test/connection_test.rb
|
78
70
|
- test/jms.yml
|
79
71
|
- test/log4j.properties
|
80
72
|
- test/message_test.rb
|
81
73
|
- test/session_pool_test.rb
|
82
74
|
- test/session_test.rb
|
75
|
+
- test/test_helper.rb
|
83
76
|
homepage: https://github.com/reidmorrison/jruby-jms
|
84
77
|
licenses:
|
85
78
|
- Apache License V2.0
|
@@ -100,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
93
|
version: '0'
|
101
94
|
requirements: []
|
102
95
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.4.8
|
104
97
|
signing_key:
|
105
98
|
specification_version: 4
|
106
99
|
summary: JRuby interface into JMS
|
@@ -111,3 +104,4 @@ test_files:
|
|
111
104
|
- test/message_test.rb
|
112
105
|
- test/session_pool_test.rb
|
113
106
|
- test/session_test.rb
|
107
|
+
- test/test_helper.rb
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activesupport (4.0.2)
|
5
|
-
i18n (~> 0.6, >= 0.6.4)
|
6
|
-
minitest (~> 4.2)
|
7
|
-
multi_json (~> 1.3)
|
8
|
-
thread_safe (~> 0.1)
|
9
|
-
tzinfo (~> 0.3.37)
|
10
|
-
atomic (1.1.14)
|
11
|
-
atomic (1.1.14-java)
|
12
|
-
gene_pool (1.3.2)
|
13
|
-
i18n (0.6.9)
|
14
|
-
minitest (4.7.5)
|
15
|
-
multi_json (1.8.4)
|
16
|
-
rake (10.1.1)
|
17
|
-
shoulda (3.5.0)
|
18
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
19
|
-
shoulda-matchers (>= 1.4.1, < 3.0)
|
20
|
-
shoulda-context (1.1.6)
|
21
|
-
shoulda-matchers (2.5.0)
|
22
|
-
activesupport (>= 3.0.0)
|
23
|
-
thread_safe (0.1.3)
|
24
|
-
atomic
|
25
|
-
thread_safe (0.1.3-java)
|
26
|
-
atomic
|
27
|
-
tzinfo (0.3.38)
|
28
|
-
|
29
|
-
PLATFORMS
|
30
|
-
java
|
31
|
-
ruby
|
32
|
-
|
33
|
-
DEPENDENCIES
|
34
|
-
gene_pool
|
35
|
-
rake
|
36
|
-
shoulda
|