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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +24 -7
  3. data/README.md +49 -49
  4. data/Rakefile +17 -12
  5. data/lib/jms.rb +8 -17
  6. data/lib/jms/bytes_message.rb +3 -19
  7. data/lib/jms/connection.rb +63 -83
  8. data/lib/jms/map_message.rb +9 -25
  9. data/lib/jms/message.rb +22 -173
  10. data/lib/jms/message_consumer.rb +23 -35
  11. data/lib/jms/message_listener_impl.rb +22 -38
  12. data/lib/jms/message_producer.rb +9 -25
  13. data/lib/jms/mq_workaround.rb +11 -26
  14. data/lib/jms/object_message.rb +1 -17
  15. data/lib/jms/oracle_a_q_connection_factory.rb +4 -21
  16. data/lib/jms/queue_browser.rb +2 -18
  17. data/lib/jms/session.rb +92 -106
  18. data/lib/jms/session_pool.rb +34 -41
  19. data/lib/jms/text_message.rb +0 -16
  20. data/lib/jms/version.rb +1 -1
  21. data/test/connection_test.rb +35 -81
  22. data/test/jms.yml +18 -8
  23. data/test/message_test.rb +27 -43
  24. data/test/session_pool_test.rb +30 -46
  25. data/test/session_test.rb +30 -45
  26. data/test/test_helper.rb +33 -0
  27. metadata +20 -26
  28. data/Gemfile +0 -8
  29. data/Gemfile.lock +0 -36
  30. data/examples/advanced/session_pool.rb +0 -37
  31. data/examples/client-server/replier.rb +0 -29
  32. data/examples/client-server/requestor.rb +0 -40
  33. data/examples/file-to-q/files_to_q.rb +0 -51
  34. data/examples/file-to-q/q_to_files.rb +0 -44
  35. data/examples/invm/invm.rb +0 -44
  36. data/examples/invm/log4j.properties +0 -58
  37. data/examples/jms.yml +0 -149
  38. data/examples/performance/consumer.rb +0 -25
  39. data/examples/performance/producer.rb +0 -31
  40. data/examples/producer-consumer/browser.rb +0 -24
  41. data/examples/producer-consumer/consumer.rb +0 -24
  42. data/examples/producer-consumer/consumer_async.rb +0 -41
  43. data/examples/producer-consumer/producer.rb +0 -25
  44. data/examples/publish-subscribe/publish.rb +0 -24
  45. data/examples/publish-subscribe/subscribe.rb +0 -31
  46. data/lib/jms/logging.rb +0 -50
  47. data/nbproject/private/private.properties +0 -3
  48. data/nbproject/private/rake-d.txt +0 -5
  49. data/parallel_minion.gemspec +0 -21
@@ -14,8 +14,6 @@ module JMS
14
14
  # see regular session parameters from: JMS::Connection#initialize
15
15
  #
16
16
  # Additional parameters for controlling the session pool itself
17
- # :pool_name Name of the pool as it shows up in the logger.
18
- # Default: 'JMS::SessionPool'
19
17
  # :pool_size Maximum Pool Size. Default: 10
20
18
  # The pool only grows as needed and will never exceed
21
19
  # :pool_size
@@ -25,9 +23,8 @@ module JMS
25
23
  # :pool_warn_timeout Number of seconds to wait before logging a warning when a
26
24
  # session in the pool is not available
27
25
  # Default: 5
28
- # :pool_logger Supply a logger that responds to #debug, #info, #warn and #debug?
29
- # For example: Rails.logger
30
- # Default: JMS.logger
26
+ # :pool_name Name of the pool as it shows up in the logger.
27
+ # Default: 'JMS::SessionPool'
31
28
  # Example:
32
29
  # session_pool = connection.create_session_pool(config)
33
30
  # session_pool.session do |session|
@@ -38,22 +35,26 @@ module JMS
38
35
  # Save Session params since it will be used every time a new session is
39
36
  # created in the pool
40
37
  session_params = params.nil? ? {} : params.dup
41
- logger = session_params[:pool_logger] || JMS.logger
42
- # Define how GenePool can create new sessions
43
- @pool = GenePool.new(
44
- :name => session_params[:pool_name] || self.class.name,
45
- :pool_size => session_params[:pool_size] || 10,
46
- :warn_timeout => session_params[:pool_warn_timeout] || 5,
47
- :timeout => session_params[:pool_timeout] || 60,
48
- :close_proc => nil,
49
- :logger => logger) do
50
- connection.create_session(session_params)
38
+ logger = SemanticLogger[session_params[:pool_name] || self.class]
39
+
40
+ # Use GenePool can create and manage the pool of sessions
41
+ @pool = GenePool.new(
42
+ name: '',
43
+ pool_size: session_params[:pool_size] || 10,
44
+ warn_timeout: session_params[:pool_warn_timeout] || 5,
45
+ timeout: session_params[:pool_timeout] || 60,
46
+ close_proc: nil,
47
+ logger: logger
48
+ ) do
49
+ session = connection.create_session(session_params)
50
+ # Turn on Java class persistence: https://github.com/jruby/jruby/wiki/Persistence
51
+ session.class.__persistent__ = true
52
+ session
51
53
  end
52
54
 
53
55
  # Handle connection failures
54
56
  connection.on_exception do |jms_exception|
55
- logger.error "JMS Connection Exception has occurred: #{jms_exception}" if logger
56
- #TODO: Close all sessions in the pool and release from the pool?
57
+ logger.error "JMS Connection Exception has occurred: #{jms_exception.inspect}"
57
58
  end
58
59
  end
59
60
 
@@ -83,30 +84,29 @@ module JMS
83
84
  # returned to the pool.
84
85
  #
85
86
  # Parameters:
86
- # :queue_name => String: Name of the Queue to return
87
- # Symbol: :temporary => Create temporary queue
87
+ # queue_name: [String] Name of the Queue to return
88
+ # [Symbol] Create temporary queue
88
89
  # Mandatory unless :topic_name is supplied
89
90
  # Or,
90
- # :topic_name => String: Name of the Topic to write to or subscribe to
91
- # Symbol: :temporary => Create temporary topic
91
+ # topic_name: [String] Name of the Topic to write to or subscribe to
92
+ # [Symbol] Create temporary topic
92
93
  # Mandatory unless :queue_name is supplied
93
94
  # Or,
94
- # :destination=> Explicit javaxJms::Destination to use
95
+ # destination: [javaxJms::Destination] Destination to use
95
96
  #
96
- # :selector => Filter which messages should be returned from the queue
97
+ # selector: Filter which messages should be returned from the queue
97
98
  # Default: All messages
98
- # :no_local => Determine whether messages published by its own connection
99
+ # no_local: Determine whether messages published by its own connection
99
100
  # should be delivered to it
100
101
  # Default: false
101
102
  #
102
103
  # Example
103
- # session_pool.consumer(:queue_name => 'MyQueue') do |session, consumer|
104
+ # session_pool.consumer(queue_name: 'MyQueue') do |session, consumer|
104
105
  # message = consumer.receive(timeout)
105
106
  # puts message.data if message
106
107
  # end
107
108
  def consumer(params, &block)
108
109
  session do |s|
109
- consumer = nil
110
110
  begin
111
111
  consumer = s.consumer(params)
112
112
  block.call(s, consumer)
@@ -122,23 +122,22 @@ module JMS
122
122
  # returned to the pool.
123
123
  #
124
124
  # Parameters:
125
- # :queue_name => String: Name of the Queue to send messages to
126
- # Symbol: :temporary => Create temporary queue
125
+ # queue_name: [String] Name of the Queue to return
126
+ # [Symbol] Create temporary queue
127
127
  # Mandatory unless :topic_name is supplied
128
128
  # Or,
129
- # :topic_name => String: Name of the Topic to send message to
130
- # Symbol: :temporary => Create temporary topic
129
+ # topic_name: [String] Name of the Topic to write to or subscribe to
130
+ # [Symbol] Create temporary topic
131
131
  # Mandatory unless :queue_name is supplied
132
132
  # Or,
133
- # :destination=> Explicit JMS::Destination to use
133
+ # destination: [javaxJms::Destination] Destination to use
134
134
  #
135
135
  # Example
136
- # session_pool.producer(:queue_name => 'ExampleQueue') do |session, producer|
136
+ # session_pool.producer(queue_name: 'ExampleQueue') do |session, producer|
137
137
  # producer.send(session.message("Hello World"))
138
138
  # end
139
139
  def producer(params, &block)
140
140
  session do |s|
141
- producer = nil
142
141
  begin
143
142
  producer = s.producer(params)
144
143
  block.call(s, producer)
@@ -154,15 +153,9 @@ module JMS
154
153
  #
155
154
  # Note: Once closed a session pool cannot be re-used. A new instance must
156
155
  # be created
157
- #
158
- # TODO: Allow an option to wait for active sessions to be returned before
159
- # closing
160
156
  def close
161
- @pool.each do |s|
162
- s.close
163
- end
157
+ @pool.each { |s| s.close }
164
158
  end
165
159
 
166
160
  end
167
-
168
- end
161
+ end
@@ -1,19 +1,3 @@
1
- ################################################################################
2
- # Copyright 2008, 2009, 2010, 2011 J. Reid Morrison
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- ################################################################################
16
-
17
1
  #Interface javax.jms.TextMessage
18
2
  module JMS::TextMessage
19
3
  def data
data/lib/jms/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JMS #:nodoc
2
- VERSION = "1.1.0"
2
+ VERSION = '1.2.0'
3
3
  end
@@ -1,68 +1,43 @@
1
- # Allow examples to be run in-place without requiring a gem install
2
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
3
-
4
- require 'rubygems'
5
- require 'test/unit'
6
- require 'shoulda'
7
- require 'jms'
8
- require 'yaml'
9
-
10
- # Set Log4J properties file so that it does not need to be in the CLASSPATH
11
- java.lang.System.properties['log4j.configuration'] = "test/log4j.properties"
12
-
13
- class JMSTest < Test::Unit::TestCase
14
- context 'JMS Connection' do
15
- # Load configuration from jms.yml
16
- setup do
17
- # To change the JMS provider, edit jms.yml and change :default
18
-
19
- # Load Connection parameters from configuration file
20
- cfg = YAML.load_file(File.join(File.dirname(__FILE__), 'jms.yml'))
21
- jms_provider = cfg['default']
22
- @config = cfg[jms_provider]
23
- raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless @config
24
- @queue_name = @config.delete(:queue_name) || raise("Mandatory :queue_name missing from jms.yml")
25
- @topic_name = @config.delete(:topic_name) || raise("Mandatory :topic_name missing from jms.yml")
1
+ require_relative 'test_helper'
2
+
3
+ class ConnectionTest < Minitest::Test
4
+ describe JMS::Connection do
5
+ before do
6
+ @config, @queue_name, @topic_name = read_config
26
7
  end
27
8
 
28
- should 'Create Connection to the Broker/Server' do
9
+ it 'Create Connection to the Broker/Server' do
29
10
  connection = JMS::Connection.new(@config)
30
- JMS::logger.info connection.to_s
31
- assert_not_nil connection
11
+ JMS.logger.info connection.to_s
12
+ assert connection
32
13
  connection.close
33
14
  end
34
15
 
35
- should 'Create and start Connection to the Broker/Server with block' do
16
+ it 'Create and start Connection to the Broker/Server with block' do
36
17
  JMS::Connection.start(@config) do |connection|
37
- assert_not_nil connection
18
+ assert connection
38
19
  end
39
20
  end
40
21
 
41
- should 'Create and start Connection to the Broker/Server with block and start one session' do
22
+ it 'Create and start Connection to the Broker/Server with block and start one session' do
42
23
  JMS::Connection.session(@config) do |session|
43
- assert_not_nil session
24
+ assert session
44
25
  end
45
26
  end
46
27
 
47
- should 'Start and stop connection' do
28
+ it 'Start and stop connection' do
48
29
  connection = JMS::Connection.new(@config)
49
- assert_not_nil connection
30
+ assert connection
50
31
  assert_nil connection.start
51
32
 
52
33
  assert_nil connection.stop
53
34
  assert_nil connection.close
54
35
  end
55
36
 
56
- should 'Create a session from the connection' do
37
+ it 'Create a session from the connection' do
57
38
  connection = JMS::Connection.new(@config)
58
-
59
- session_parms = {
60
- :transacted => true,
61
- :options => JMS::Session::AUTO_ACKNOWLEDGE
62
- }
63
-
64
- session = connection.create_session
65
- assert_not_nil session
39
+ session = connection.create_session
40
+ assert session
66
41
  assert_equal session.transacted?, false
67
42
  assert_nil session.close
68
43
 
@@ -70,11 +45,10 @@ class JMSTest < Test::Unit::TestCase
70
45
  assert_nil connection.close
71
46
  end
72
47
 
73
- should 'Create a session with a block' do
48
+ it 'Create a session with a block' do
74
49
  connection = JMS::Connection.new(@config)
75
-
76
50
  connection.session do |session|
77
- assert_not_nil session
51
+ assert session
78
52
  assert_equal session.transacted?, false
79
53
  end
80
54
 
@@ -82,25 +56,19 @@ class JMSTest < Test::Unit::TestCase
82
56
  assert_nil connection.close
83
57
  end
84
58
 
85
- should 'create a session without a block and throw exception' do
59
+ it 'create a session without a block and throw exception' do
86
60
  connection = JMS::Connection.new(@config)
87
61
 
88
- assert_raise(RuntimeError) { connection.session }
62
+ assert_raises(ArgumentError) { connection.session }
89
63
 
90
64
  assert_nil connection.stop
91
65
  assert_nil connection.close
92
66
  end
93
67
 
94
- should 'Create a session from the connection with params' do
68
+ it 'Create a session from the connection with params' do
95
69
  connection = JMS::Connection.new(@config)
96
-
97
- session_parms = {
98
- :transacted => true,
99
- :options => JMS::Session::AUTO_ACKNOWLEDGE
100
- }
101
-
102
- session = connection.create_session(session_parms)
103
- assert_not_nil session
70
+ session = connection.create_session(transacted: true, options: JMS::Session::AUTO_ACKNOWLEDGE)
71
+ assert session
104
72
  assert_equal session.transacted?, true
105
73
  # When session is transacted, options are ignore, so ack mode must be transacted
106
74
  assert_equal session.acknowledge_mode, JMS::Session::SESSION_TRANSACTED
@@ -110,16 +78,10 @@ class JMSTest < Test::Unit::TestCase
110
78
  assert_nil connection.close
111
79
  end
112
80
 
113
- should 'Create a session from the connection with block and params' do
81
+ it 'Create a session from the connection with block and params' do
114
82
  JMS::Connection.start(@config) do |connection|
115
-
116
- session_parms = {
117
- :transacted => true,
118
- :options => JMS::Session::CLIENT_ACKNOWLEDGE
119
- }
120
-
121
- connection.session(session_parms) do |session|
122
- assert_not_nil session
83
+ connection.session(transacted: true, options: JMS::Session::CLIENT_ACKNOWLEDGE) do |session|
84
+ assert session
123
85
  assert_equal session.transacted?, true
124
86
  # When session is transacted, options are ignore, so ack mode must be transacted
125
87
  assert_equal session.acknowledge_mode, JMS::Session::SESSION_TRANSACTED
@@ -127,33 +89,25 @@ class JMSTest < Test::Unit::TestCase
127
89
  end
128
90
  end
129
91
 
130
- should 'Create a session from the connection with block and params opposite test' do
92
+ it 'Create a session from the connection with block and params opposite test' do
131
93
  JMS::Connection.start(@config) do |connection|
132
-
133
- session_parms = {
134
- :transacted => false,
135
- :options => JMS::Session::AUTO_ACKNOWLEDGE
136
- }
137
-
138
- connection.session(session_parms) do |session|
139
- assert_not_nil session
94
+ connection.session(transacted: false, options: JMS::Session::AUTO_ACKNOWLEDGE) do |session|
95
+ assert session
140
96
  assert_equal session.transacted?, false
141
97
  assert_equal session.acknowledge_mode, JMS::Session::AUTO_ACKNOWLEDGE
142
98
  end
143
99
  end
144
100
  end
145
101
 
146
- context 'JMS Connection additional capabilities' do
147
-
148
- should 'start an on_message handler' do
102
+ describe 'additional capabilities' do
103
+ it 'start an on_message handler' do
149
104
  JMS::Connection.start(@config) do |connection|
150
105
  value = nil
151
- connection.on_message(:transacted => true, :queue_name => :temporary) do |message|
152
- value = "received"
106
+ connection.on_message(transacted: true, queue_name: :temporary) do |message|
107
+ value = 'received'
153
108
  end
154
109
  end
155
110
  end
156
-
157
111
  end
158
112
 
159
113
  end
data/test/jms.yml CHANGED
@@ -9,10 +9,10 @@
9
9
  # Which JMS Provider to use by default
10
10
 
11
11
  #default: hornetq222
12
- #default: hornetq225
12
+ #default: hornetq2_4_0
13
13
  #default: activemq543
14
14
  #default: activemq551
15
- default: activemq590
15
+ default: activemq5_11_1
16
16
  #default: webspheremq6
17
17
  #default: webspheremq7
18
18
 
@@ -43,7 +43,16 @@ activemq590:
43
43
  :queue_name: TestQueue
44
44
  :topic_name: TestTopic
45
45
 
46
- hornetq225:
46
+ activemq5_11_1:
47
+ :factory: org.apache.activemq.ActiveMQConnectionFactory
48
+ :broker_url: tcp://localhost:61616
49
+ :require_jars:
50
+ - /usr/local/Cellar/activemq/5.11.1/libexec/activemq-all-5.11.1.jar
51
+ - /usr/local/Cellar/activemq/5.11.1/libexec/lib/optional/log4j-1.2.17.jar
52
+ :queue_name: TestQueue
53
+ :topic_name: TestTopic
54
+
55
+ hornetq2_4_0:
47
56
  # Connect to a local HornetQ Broker using JNDI
48
57
  :jndi_name: /ConnectionFactory
49
58
  :jndi_context:
@@ -53,11 +62,12 @@ hornetq225:
53
62
  java.naming.security.principal: guest
54
63
  java.naming.security.credentials: guest
55
64
  :require_jars:
56
- - ~/jms/hornetq-2.2.5.Final/lib/hornetq-core-client.jar
57
- - ~/jms/hornetq-2.2.5.Final/lib/netty.jar
58
- - ~/jms/hornetq-2.2.5.Final/lib/hornetq-jms-client.jar
59
- - ~/jms/hornetq-2.2.5.Final/lib/jboss-jms-api.jar
60
- - ~/jms/hornetq-2.2.5.Final/lib/jnp-client.jar
65
+ - /usr/local/Cellar/hornetq/2.4.0/libexec/lib/hornetq-commons.jar
66
+ - /usr/local/Cellar/hornetq/2.4.0/libexec/lib/hornetq-core-client.jar
67
+ - /usr/local/Cellar/hornetq/2.4.0/libexec/lib/hornetq-jms-client.jar
68
+ - /usr/local/Cellar/hornetq/2.4.0/libexec/lib/jboss-jms-api.jar
69
+ - /usr/local/Cellar/hornetq/2.4.0/libexec/lib/jnp-client.jar
70
+ - /usr/local/Cellar/hornetq/2.4.0/libexec/lib/netty.jar
61
71
  :queue_name: TestQueue
62
72
  :topic_name: TestTopic
63
73
 
data/test/message_test.rb CHANGED
@@ -1,37 +1,21 @@
1
- # Allow examples to be run in-place without requiring a gem install
2
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
1
+ require_relative 'test_helper'
3
2
 
4
- require 'rubygems'
5
- require 'test/unit'
6
- require 'shoulda'
7
- require 'jms'
8
- require 'yaml'
9
-
10
- class JMSTest < Test::Unit::TestCase
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")
3
+ class MessageTest < Minitest::Test
4
+ describe 'JMS::Message' do
5
+ before do
6
+ @config, @queue_name, @topic_name = read_config
23
7
  end
24
8
 
25
- should 'produce and consume messages to/from a temporary queue' do
9
+ it 'produce and consume messages to/from a temporary queue' do
26
10
  JMS::Connection.session(@config) do |session|
27
- assert_not_nil session
11
+ assert session
28
12
  data = nil
29
- session.producer(:queue_name => :temporary) do |producer|
13
+ session.producer(queue_name: :temporary) do |producer|
30
14
  # Send Message
31
15
  producer.send(session.message('Hello World'))
32
16
 
33
17
  # Consume Message
34
- session.consume(:destination => producer.destination, :timeout=>1000) do |message|
18
+ session.consume(destination: producer.destination, timeout: 1000) do |message|
35
19
  assert_equal message.java_kind_of?(JMS::TextMessage), true
36
20
  data = message.data
37
21
  end
@@ -40,23 +24,23 @@ class JMSTest < Test::Unit::TestCase
40
24
  end
41
25
  end
42
26
 
43
- should 'produce, browse and consume messages to/from a queue' do
27
+ it 'produce, browse and consume messages to/from a queue' do
44
28
  JMS::Connection.session(@config) do |session|
45
- assert_not_nil session
46
- data = :timed_out
29
+ assert session
30
+ data = :timed_out
47
31
  browse_data = :timed_out
48
- session.producer(:queue_name => @queue_name) do |producer|
32
+ session.producer(queue_name: @queue_name) do |producer|
49
33
  # Send Message
50
34
  producer.send(session.message('Hello World'))
51
35
 
52
36
  # Browse Message
53
- session.browse(:queue_name => @queue_name, :timeout=>1000) do |message|
37
+ session.browse(queue_name: @queue_name, timeout: 1000) do |message|
54
38
  assert_equal message.java_kind_of?(JMS::TextMessage), true
55
39
  browse_data = message.data
56
40
  end
57
41
 
58
42
  # Consume Message
59
- session.consume(:queue_name => @queue_name, :timeout=>1000) do |message|
43
+ session.consume(queue_name: @queue_name, timeout: 1000) do |message|
60
44
  assert_equal message.java_kind_of?(JMS::TextMessage), true
61
45
  data = message.data
62
46
  end
@@ -66,9 +50,9 @@ class JMSTest < Test::Unit::TestCase
66
50
  end
67
51
  end
68
52
 
69
- should 'support setting persistence using symbols and the java constants' do
53
+ it 'support setting persistence using symbols and the java constants' do
70
54
  JMS::Connection.session(@config) do |session|
71
- message = session.message('Hello World')
55
+ message = session.message('Hello World')
72
56
  message.jms_delivery_mode_sym = :non_persistent
73
57
  assert_equal message.jms_delivery_mode_sym, :non_persistent
74
58
  message.jms_delivery_mode_sym = :persistent
@@ -76,12 +60,12 @@ class JMSTest < Test::Unit::TestCase
76
60
  end
77
61
  end
78
62
 
79
- should 'produce and consume non-persistent messages' do
63
+ it 'produce and consume non-persistent messages' do
80
64
  JMS::Connection.session(@config) do |session|
81
- assert_not_nil session
65
+ assert session
82
66
  data = nil
83
- session.producer(:queue_name => :temporary) do |producer|
84
- message = session.message('Hello World')
67
+ session.producer(queue_name: :temporary) do |producer|
68
+ message = session.message('Hello World')
85
69
  message.jms_delivery_mode_sym = :non_persistent
86
70
  assert_equal :non_persistent, message.jms_delivery_mode_sym
87
71
  assert_equal false, message.persistent?
@@ -90,7 +74,7 @@ class JMSTest < Test::Unit::TestCase
90
74
  producer.send(message)
91
75
 
92
76
  # Consume Message
93
- session.consume(:destination => producer.destination, :timeout=>1000) do |message|
77
+ session.consume(destination: producer.destination, timeout: 1000) do |message|
94
78
  assert_equal message.java_kind_of?(JMS::TextMessage), true
95
79
  data = message.data
96
80
  #assert_equal :non_persistent, message.jms_delivery_mode
@@ -101,12 +85,12 @@ class JMSTest < Test::Unit::TestCase
101
85
  end
102
86
  end
103
87
 
104
- should 'produce and consume persistent messages' do
88
+ it 'produce and consume persistent messages' do
105
89
  JMS::Connection.session(@config) do |session|
106
- assert_not_nil session
90
+ assert session
107
91
  data = nil
108
- session.producer(:queue_name => @queue_name) do |producer|
109
- message = session.message('Hello World')
92
+ session.producer(queue_name: @queue_name) do |producer|
93
+ message = session.message('Hello World')
110
94
  message.jms_delivery_mode_sym = :persistent
111
95
  assert_equal :persistent, message.jms_delivery_mode_sym
112
96
  assert_equal true, message.persistent?
@@ -115,7 +99,7 @@ class JMSTest < Test::Unit::TestCase
115
99
  producer.send(message)
116
100
 
117
101
  # Consume Message
118
- session.consume(:destination => producer.destination, :timeout=>1000) do |message|
102
+ session.consume(destination: producer.destination, timeout: 1000) do |message|
119
103
  assert_equal message.java_kind_of?(JMS::TextMessage), true
120
104
  data = message.data
121
105
  assert_equal :persistent, message.jms_delivery_mode_sym