jruby-jms 0.11.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/Gemfile.lock +24 -0
- data/Rakefile +7 -2
- data/examples/file-to-q/files_to_q.rb +51 -0
- data/examples/file-to-q/q_to_files.rb +44 -0
- data/examples/producer-consumer/consumer_async.rb +14 -3
- data/jruby-jms-0.11.2.gem +0 -0
- data/lib/jms.rb +1 -0
- data/lib/jms/connection.rb +1 -0
- data/lib/jms/message.rb +2 -2
- data/lib/jms/message_producer.rb +1 -1
- data/lib/jms/mq_workaround.rb +70 -0
- data/lib/jms/session.rb +40 -23
- data/lib/jms/session_pool.rb +9 -4
- data/lib/jms/version.rb +3 -0
- data/nbproject/private/config.properties +0 -0
- data/nbproject/private/private.properties +4 -0
- data/nbproject/private/private.xml +4 -0
- data/nbproject/private/rake-d.txt +5 -0
- data/test/jms.yml +84 -12
- data/test/message_test.rb +1 -2
- metadata +152 -78
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.2.8)
|
5
|
+
i18n (~> 0.6)
|
6
|
+
multi_json (~> 1.0)
|
7
|
+
gene_pool (1.3.0)
|
8
|
+
i18n (0.6.1)
|
9
|
+
multi_json (1.3.6)
|
10
|
+
rake (0.9.2.2)
|
11
|
+
shoulda (3.3.2)
|
12
|
+
shoulda-context (~> 1.0.1)
|
13
|
+
shoulda-matchers (~> 1.4.1)
|
14
|
+
shoulda-context (1.0.1)
|
15
|
+
shoulda-matchers (1.4.1)
|
16
|
+
activesupport (>= 3.0.0)
|
17
|
+
|
18
|
+
PLATFORMS
|
19
|
+
java
|
20
|
+
|
21
|
+
DEPENDENCIES
|
22
|
+
gene_pool
|
23
|
+
rake
|
24
|
+
shoulda
|
data/Rakefile
CHANGED
@@ -1,22 +1,27 @@
|
|
1
|
+
lib = File.expand_path('../lib/', __FILE__)
|
2
|
+
$:.unshift lib unless $:.include?(lib)
|
3
|
+
|
1
4
|
raise "jruby-jms must be built with JRuby: try again with `jruby -S rake'" unless defined?(JRUBY_VERSION)
|
2
5
|
|
3
6
|
require 'rake/clean'
|
4
7
|
require 'rake/testtask'
|
5
8
|
require 'date'
|
6
9
|
require 'java'
|
10
|
+
require 'jms/version'
|
7
11
|
|
8
12
|
desc "Build gem"
|
9
13
|
task :gem do |t|
|
10
14
|
gemspec = Gem::Specification.new do |s|
|
11
15
|
s.name = 'jruby-jms'
|
12
|
-
s.version =
|
16
|
+
s.version = JMS::VERSION
|
13
17
|
s.author = 'Reid Morrison'
|
14
|
-
s.email = '
|
18
|
+
s.email = 'reidmo@gmail.com'
|
15
19
|
s.homepage = 'https://github.com/reidmorrison/jruby-jms'
|
16
20
|
s.date = Date.today.to_s
|
17
21
|
s.description = 'JRuby-JMS is a Java and Ruby library that exposes the Java JMS API in a ruby friendly way. For JRuby only.'
|
18
22
|
s.summary = 'JRuby interface into JMS'
|
19
23
|
s.files = FileList["./**/*"].exclude('*.gem', './nbproject/*').map{|f| f.sub(/^\.\//, '')}
|
24
|
+
s.add_dependency 'gene_pool'
|
20
25
|
s.has_rdoc = true
|
21
26
|
end
|
22
27
|
Gem::Builder.new(gemspec).build
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#
|
2
|
+
# Example : files_to_q : Place all files in a directory to a queue
|
3
|
+
# Each file is written as a separate message
|
4
|
+
# Place the data in a file ending with '.data'
|
5
|
+
# and the header information in a file with same name, but with an
|
6
|
+
# extension of '.yml'
|
7
|
+
#
|
8
|
+
# jruby files_to_q.rb activemq my_queue
|
9
|
+
#
|
10
|
+
|
11
|
+
# Allow examples to be run in-place without requiring a gem install
|
12
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
|
13
|
+
|
14
|
+
require 'rubygems'
|
15
|
+
require 'jms'
|
16
|
+
require 'yaml'
|
17
|
+
|
18
|
+
raise("Required Parameters: 'jms_provider' 'queue_name' 'input_directory'") unless ARGV.count >= 2
|
19
|
+
jms_provider = ARGV[0]
|
20
|
+
queue_name = ARGV[1]
|
21
|
+
path = ARGV[2] || queue_name
|
22
|
+
|
23
|
+
# Load Connection parameters from configuration file
|
24
|
+
config = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'jms.yml'))[jms_provider]
|
25
|
+
raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless config
|
26
|
+
|
27
|
+
counter = 0
|
28
|
+
# Consume all available messages on the queue
|
29
|
+
JMS::Connection.session(config) do |session|
|
30
|
+
session.producer(:queue_name => queue_name) do |producer|
|
31
|
+
Dir.glob(File.join(path,'*.data')) do |filename|
|
32
|
+
unless File.directory?(filename)
|
33
|
+
printf("%5d: #{filename}\n",counter = counter + 1)
|
34
|
+
data = File.open(filename, 'rb') {|file| file.read }
|
35
|
+
header_filename = File.join(File.dirname(filename), File.basename(filename))
|
36
|
+
header_filename = header_filename[0, header_filename.length - '.data'.length] + '.yml'
|
37
|
+
header = File.exist?(header_filename) ? YAML.load_file(header_filename) : nil
|
38
|
+
message = session.message(data, :bytes)
|
39
|
+
if header
|
40
|
+
header[:attributes].each_pair do |k,v|
|
41
|
+
next if k == :jms_destination
|
42
|
+
message.send("#{k}=".to_sym, v) if message.respond_to?("#{k}=".to_sym)
|
43
|
+
end if header[:attributes]
|
44
|
+
message.properties = header[:properties] || {}
|
45
|
+
end
|
46
|
+
producer.send(message)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
puts "Read #{counter} messages from #{path} and wrote to #{queue_name}"
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#
|
2
|
+
# Example: q_to_files:
|
3
|
+
# Copy all messages in a queue to separate files in a directory
|
4
|
+
# The messages are left on the queue by
|
5
|
+
#
|
6
|
+
# jruby q_to_files.rb activemq my_queue
|
7
|
+
#
|
8
|
+
|
9
|
+
# Allow examples to be run in-place without requiring a gem install
|
10
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require 'jms'
|
14
|
+
require 'yaml'
|
15
|
+
require 'fileutils'
|
16
|
+
|
17
|
+
raise("Required Parameters: 'jms_provider' 'queue_name' 'output_directory'") unless ARGV.count >= 2
|
18
|
+
jms_provider = ARGV[0]
|
19
|
+
queue_name = ARGV[1]
|
20
|
+
path = ARGV[2] || queue_name
|
21
|
+
|
22
|
+
# Load Connection parameters from configuration file
|
23
|
+
config = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'jms.yml'))[jms_provider]
|
24
|
+
raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless config
|
25
|
+
|
26
|
+
# Create supplied path if it does not exist
|
27
|
+
FileUtils.mkdir_p(path)
|
28
|
+
|
29
|
+
counter = 0
|
30
|
+
# Consume all available messages on the queue
|
31
|
+
JMS::Connection.session(config) do |session|
|
32
|
+
session.browse(:queue_name => queue_name, :timeout=>1000) do |message|
|
33
|
+
counter += 1
|
34
|
+
filename = File.join(path, "message_%03d" % counter)
|
35
|
+
File.open(filename+'.data', 'wb') {|file| file.write(message.data) }
|
36
|
+
header = {
|
37
|
+
:attributes => message.attributes,
|
38
|
+
:properties => message.properties
|
39
|
+
}
|
40
|
+
File.open(filename+'.yml', 'wb') {|file| file.write(header.to_yaml) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
puts "Saved #{counter} messages to #{path}"
|
@@ -16,15 +16,26 @@ jms_provider = ARGV[0] || 'activemq'
|
|
16
16
|
config = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'jms.yml'))[jms_provider]
|
17
17
|
raise "JMS Provider option:#{jms_provider} not found in jms.yml file" unless config
|
18
18
|
|
19
|
+
continue = true
|
20
|
+
|
21
|
+
trap("INT") {
|
22
|
+
JMS::logger.info "CTRL + C"
|
23
|
+
continue = false
|
24
|
+
}
|
25
|
+
|
19
26
|
# Consume all available messages on the queue
|
20
27
|
JMS::Connection.start(config) do |connection|
|
21
|
-
|
22
|
-
# Define Asynchronous code block to be called every time a message is
|
28
|
+
|
29
|
+
# Define Asynchronous code block to be called every time a message is received
|
23
30
|
connection.on_message(:queue_name => 'ExampleQueue') do |message|
|
24
31
|
JMS::logger.info message.inspect
|
25
32
|
end
|
26
33
|
|
27
34
|
# Since the on_message handler above is in a separate thread the thread needs
|
28
35
|
# to do some other work. For this example it will just sleep for 10 seconds
|
29
|
-
|
36
|
+
while(continue)
|
37
|
+
sleep 10
|
38
|
+
end
|
39
|
+
|
40
|
+
JMS::logger.info "closing ..."
|
30
41
|
end
|
Binary file
|
data/lib/jms.rb
CHANGED
data/lib/jms/connection.rb
CHANGED
data/lib/jms/message.rb
CHANGED
@@ -225,8 +225,8 @@ module JMS::Message
|
|
225
225
|
def attributes
|
226
226
|
{
|
227
227
|
:jms_correlation_id => jms_correlation_id,
|
228
|
-
:
|
229
|
-
:jms_destination => jms_destination,
|
228
|
+
:jms_delivery_mode_sym => jms_delivery_mode_sym,
|
229
|
+
:jms_destination => jms_destination.nil? ? nil : jms_destination.to_string,
|
230
230
|
:jms_expiration => jms_expiration,
|
231
231
|
:jms_message_id => jms_message_id,
|
232
232
|
:jms_priority => jms_priority,
|
data/lib/jms/message_producer.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
# Extend JMS Message Producer Interface with Ruby methods
|
18
18
|
#
|
19
|
-
# For further help on javax.jms.
|
19
|
+
# For further help on javax.jms.MessageProducer
|
20
20
|
# http://download.oracle.com/javaee/6/api/javax/jms/MessageProducer.html
|
21
21
|
#
|
22
22
|
# Interface javax.jms.Producer
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Workaround for IBM MQ JMS implementation that implements some undocumented methods
|
2
|
+
|
3
|
+
begin
|
4
|
+
|
5
|
+
class com.ibm.mq.jms::MQQueueSession
|
6
|
+
|
7
|
+
if self.instance_methods.include? "consume"
|
8
|
+
def consume(params, &proc)
|
9
|
+
Java::JavaxJms::Session.instance_method(:consume).bind(self).call(params, &proc)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
class com.ibm.mq.jms::MQSession
|
17
|
+
|
18
|
+
if self.instance_methods.include? "consume"
|
19
|
+
def consume(params, &proc)
|
20
|
+
Java::JavaxJms::Session.instance_method(:consume).bind(self).call(params, &proc)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
if self.instance_methods.include? "create_destination"
|
25
|
+
def create_destination(params)
|
26
|
+
Java::JavaxJms::Session.instance_method(:create_destination).bind(self).call(params)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
class com.ibm.mq.jms::MQQueueBrowser
|
34
|
+
|
35
|
+
if self.instance_methods.include? "each"
|
36
|
+
def each(params, &proc)
|
37
|
+
Java::ComIbmMsgClientJms::JmsQueueBrowser.instance_method(:each).bind(self).call(params, &proc)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
class com.ibm.mq.jms::MQQueueReceiver
|
44
|
+
|
45
|
+
if self.instance_methods.include? "each"
|
46
|
+
def each(params, &proc)
|
47
|
+
Java::JavaxJms::MessageConsumer.instance_method(:each).bind(self).call(params, &proc)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
if self.instance_methods.include? "get"
|
52
|
+
def get(params={})
|
53
|
+
Java::JavaxJms::MessageConsumer.instance_method(:get).bind(self).call(params)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
class com.ibm.mq.jms::MQQueue
|
61
|
+
|
62
|
+
if self.instance_methods.include? "delete"
|
63
|
+
undef_method :delete
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
rescue NameError
|
69
|
+
# Ignore errors (when we aren't using MQ)
|
70
|
+
end
|
data/lib/jms/session.rb
CHANGED
@@ -115,16 +115,34 @@ module JMS::Session
|
|
115
115
|
# Duck typing is used to determine the type. If the class responds
|
116
116
|
# to :to_str then it is considered a String. Similarly if it responds to
|
117
117
|
# :each_pair it is considered to be a Hash
|
118
|
-
|
118
|
+
#
|
119
|
+
# If automated duck typing is not desired, the type of the message can be specified
|
120
|
+
# by setting the parameter 'type' to any one of:
|
121
|
+
# :text => Creates a Text Message
|
122
|
+
# :map => Creates a Map Message
|
123
|
+
# :bytes => Creates a Bytes Message
|
124
|
+
def message(data, type=nil)
|
119
125
|
jms_message = nil
|
120
|
-
if data.respond_to?(:to_str, false)
|
126
|
+
type ||= if data.respond_to?(:to_str, false)
|
127
|
+
:text
|
128
|
+
elsif data.respond_to?(:each_pair, false)
|
129
|
+
:map
|
130
|
+
else
|
131
|
+
raise "Unknown data type #{data.class.to_s} in Message"
|
132
|
+
end
|
133
|
+
|
134
|
+
case type
|
135
|
+
when :text
|
121
136
|
jms_message = self.createTextMessage
|
122
137
|
jms_message.text = data.to_str
|
123
|
-
|
138
|
+
when :map
|
124
139
|
jms_message = self.createMapMessage
|
125
140
|
jms_message.data = data
|
141
|
+
when :bytes
|
142
|
+
jms_message = self.createBytesMessage
|
143
|
+
jms_message.write_bytes(data.to_java_bytes)
|
126
144
|
else
|
127
|
-
raise "
|
145
|
+
raise "Invalid type #{type} requested"
|
128
146
|
end
|
129
147
|
jms_message
|
130
148
|
end
|
@@ -147,12 +165,18 @@ module JMS::Session
|
|
147
165
|
# To create a temporary queue:
|
148
166
|
# session.create_destination(:queue_name => :temporary)
|
149
167
|
#
|
168
|
+
# To create a queue:
|
169
|
+
# session.create_destination('queue://queue_name')
|
170
|
+
#
|
150
171
|
# To create a topic:
|
151
172
|
# session.create_destination(:topic_name => 'name of queue')
|
152
173
|
#
|
153
174
|
# To create a temporary topic:
|
154
175
|
# session.create_destination(:topic_name => :temporary)
|
155
176
|
#
|
177
|
+
# To create a topic:
|
178
|
+
# session.create_destination('topic://topic_name')
|
179
|
+
#
|
156
180
|
# Create the destination based on the parameter supplied
|
157
181
|
#
|
158
182
|
# Parameters:
|
@@ -171,9 +195,18 @@ module JMS::Session
|
|
171
195
|
# Allow a Java JMS destination object to be passed in
|
172
196
|
return params[:destination] if params[:destination] && params[:destination].java_kind_of?(JMS::Destination)
|
173
197
|
|
174
|
-
|
175
|
-
|
176
|
-
|
198
|
+
queue_name = nil
|
199
|
+
topic_name = nil
|
200
|
+
|
201
|
+
if params.is_a? String
|
202
|
+
queue_name = params['queue://'.length..-1] if params.start_with?('queue://')
|
203
|
+
topic_name = params['topic://'.length..-1] if params.start_with?('topic://')
|
204
|
+
else
|
205
|
+
# :q_name is deprecated
|
206
|
+
queue_name = params[:queue_name] || params[:q_name]
|
207
|
+
topic_name = params[:topic_name]
|
208
|
+
end
|
209
|
+
|
177
210
|
raise "Missing mandatory parameter :queue_name or :topic_name to Session::producer, Session::consumer, or Session::browser" unless queue_name || topic_name
|
178
211
|
|
179
212
|
if queue_name
|
@@ -438,19 +471,3 @@ module JMS::Session
|
|
438
471
|
self.browser(params) {|b| b.each(params, &proc)}
|
439
472
|
end
|
440
473
|
end
|
441
|
-
|
442
|
-
# Workaround for IBM MQ JMS implementation that implements an undocumented consume method
|
443
|
-
if defined? com.ibm.mq.jms::MQSession
|
444
|
-
class com.ibm.mq.jms::MQSession
|
445
|
-
def consume(params, &proc)
|
446
|
-
result = nil
|
447
|
-
c = self.consumer(params)
|
448
|
-
begin
|
449
|
-
result = c.each(params, &proc)
|
450
|
-
ensure
|
451
|
-
c.close
|
452
|
-
end
|
453
|
-
result
|
454
|
-
end
|
455
|
-
end
|
456
|
-
end
|
data/lib/jms/session_pool.rb
CHANGED
@@ -19,9 +19,12 @@ module JMS
|
|
19
19
|
# :pool_size Maximum Pool Size. Default: 10
|
20
20
|
# The pool only grows as needed and will never exceed
|
21
21
|
# :pool_size
|
22
|
+
# :pool_timeout Number of seconds to wait before raising a TimeoutError
|
23
|
+
# if no sessions are available in the poo
|
24
|
+
# Default: 60
|
22
25
|
# :pool_warn_timeout Number of seconds to wait before logging a warning when a
|
23
|
-
# session in the pool is not available
|
24
|
-
# Default: 5
|
26
|
+
# session in the pool is not available
|
27
|
+
# Default: 5
|
25
28
|
# :pool_logger Supply a logger that responds to #debug, #info, #warn and #debug?
|
26
29
|
# For example: Rails.logger
|
27
30
|
# Default: JMS.logger
|
@@ -38,9 +41,11 @@ module JMS
|
|
38
41
|
logger = session_params[:pool_logger] || JMS.logger
|
39
42
|
# Define how GenePool can create new sessions
|
40
43
|
@pool = GenePool.new(
|
41
|
-
:name
|
42
|
-
:pool_size
|
44
|
+
:name => session_params[:pool_name] || self.class.name,
|
45
|
+
:pool_size => session_params[:pool_size] || 10,
|
43
46
|
:warn_timeout => session_params[:pool_warn_timeout] || 5,
|
47
|
+
:timeout => session_params[:pool_timeout] || 60,
|
48
|
+
:close_proc => nil,
|
44
49
|
:logger => logger) do
|
45
50
|
connection.create_session(session_params)
|
46
51
|
end
|
data/lib/jms/version.rb
ADDED
File without changes
|
data/test/jms.yml
CHANGED
@@ -7,19 +7,43 @@
|
|
7
7
|
#
|
8
8
|
---
|
9
9
|
# Which JMS Provider to use by default
|
10
|
-
default: activemq
|
11
10
|
|
12
|
-
|
11
|
+
#default: hornetq222
|
12
|
+
#default: hornetq225
|
13
|
+
#default: activemq543
|
14
|
+
#default: activemq551
|
15
|
+
default: activemq570
|
16
|
+
#default: webspheremq6
|
17
|
+
#default: webspheremq7
|
18
|
+
|
19
|
+
activemq543:
|
13
20
|
:factory: org.apache.activemq.ActiveMQConnectionFactory
|
14
21
|
:broker_url: tcp://localhost:61616
|
15
22
|
:require_jars:
|
16
|
-
- ~/
|
17
|
-
- ~/Applications/apache-activemq-5.5.0/lib/optional/slf4j-log4j12-1.5.11.jar
|
18
|
-
- ~/Applications/apache-activemq-5.5.0/lib/optional/log4j-1.2.14.jar
|
23
|
+
- ~/jms/apache-activemq-5.4.3/activemq-all-5.4.3.jar
|
19
24
|
:queue_name: TestQueue
|
20
25
|
:topic_name: TestTopic
|
21
26
|
|
22
|
-
|
27
|
+
activemq551:
|
28
|
+
:factory: org.apache.activemq.ActiveMQConnectionFactory
|
29
|
+
:broker_url: tcp://localhost:61616
|
30
|
+
:require_jars:
|
31
|
+
- ~/jms/apache-activemq-5.5.1/activemq-all-5.5.1.jar
|
32
|
+
- ~/jms/apache-activemq-5.5.1/lib/optional/slf4j-log4j12-1.5.11.jar
|
33
|
+
- ~/jms/apache-activemq-5.5.1/lib/optional/log4j-1.2.14.jar
|
34
|
+
:queue_name: TestQueue
|
35
|
+
:topic_name: TestTopic
|
36
|
+
|
37
|
+
activemq570:
|
38
|
+
:factory: org.apache.activemq.ActiveMQConnectionFactory
|
39
|
+
:broker_url: tcp://localhost:61616
|
40
|
+
:require_jars:
|
41
|
+
- ~/Applications/apache-activemq-5.7.0/activemq-all-5.7.0.jar
|
42
|
+
- ~/Applications/apache-activemq-5.7.0/lib/optional/log4j-1.2.17.jar
|
43
|
+
:queue_name: TestQueue
|
44
|
+
:topic_name: TestTopic
|
45
|
+
|
46
|
+
hornetq225:
|
23
47
|
# Connect to a local HornetQ Broker using JNDI
|
24
48
|
:jndi_name: /ConnectionFactory
|
25
49
|
:jndi_context:
|
@@ -29,11 +53,59 @@ hornetq:
|
|
29
53
|
java.naming.security.principal: guest
|
30
54
|
java.naming.security.credentials: guest
|
31
55
|
:require_jars:
|
32
|
-
- ~/
|
33
|
-
- ~/
|
34
|
-
- ~/
|
35
|
-
- ~/
|
36
|
-
- ~/
|
37
|
-
|
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
|
61
|
+
:queue_name: TestQueue
|
62
|
+
:topic_name: TestTopic
|
63
|
+
|
64
|
+
hornetq222:
|
65
|
+
# Connect to a local HornetQ Broker using JNDI
|
66
|
+
:jndi_name: /ConnectionFactory
|
67
|
+
:jndi_context:
|
68
|
+
java.naming.factory.initial: org.jnp.interfaces.NamingContextFactory
|
69
|
+
java.naming.provider.url: jnp://localhost:1099
|
70
|
+
java.naming.factory.url.pkgs: org.jboss.naming:org.jnp.interfaces
|
71
|
+
java.naming.security.principal: guest
|
72
|
+
java.naming.security.credentials: guest
|
73
|
+
:require_jars:
|
74
|
+
- ~/jms/hornetq-2.2.2.Final/lib/hornetq-core-client.jar
|
75
|
+
- ~/jms/hornetq-2.2.2.Final/lib/netty.jar
|
76
|
+
- ~/jms/hornetq-2.2.2.Final/lib/hornetq-jms-client.jar
|
77
|
+
- ~/jms/hornetq-2.2.2.Final/lib/jboss-jms-api.jar
|
78
|
+
- ~/jms/hornetq-2.2.2.Final/lib/jnp-client.jar
|
79
|
+
:queue_name: TestQueue
|
80
|
+
:topic_name: TestTopic
|
81
|
+
|
82
|
+
webspheremq7:
|
83
|
+
:factory: com.ibm.mq.jms.MQConnectionFactory
|
84
|
+
:queue_manager: MYQM
|
85
|
+
:host_name: 127.0.0.1
|
86
|
+
:channel: SRVCONCHA
|
87
|
+
:port: 61414
|
88
|
+
# Transport Type: com.ibm.mq.jms.JMSC::MQJMS_TP_CLIENT_MQ_TCPIP
|
89
|
+
:transport_type: 1
|
90
|
+
:username: mqm
|
91
|
+
:require_jars:
|
92
|
+
- ~/jms/libs-ibmqm7/com.ibm.mqjms.jar
|
93
|
+
- ~/jms/libs-ibmqm7/jms.jar
|
94
|
+
- ~/jms/libs-ibmqm7/com.ibm.mq.jmqi.jar
|
95
|
+
- ~/jms/libs-ibmqm7/dhbcore.jar
|
96
|
+
:queue_name: TestQueue
|
97
|
+
:topic_name: TestTopic
|
98
|
+
|
99
|
+
webspheremq6:
|
100
|
+
:factory: com.ibm.mq.jms.MQConnectionFactory
|
101
|
+
:queue_manager: MYQM
|
102
|
+
:host_name: 127.0.0.1
|
103
|
+
:channel: SRVCONCHA
|
104
|
+
:port: 61414
|
105
|
+
# Transport Type: com.ibm.mq.jms.JMSC::MQJMS_TP_CLIENT_MQ_TCPIP
|
106
|
+
:transport_type: 1
|
107
|
+
:username: mqm
|
108
|
+
:require_jars:
|
109
|
+
- ~/jms/libs-ibmqm6/com.ibm.mqjms.jar
|
38
110
|
:queue_name: TestQueue
|
39
111
|
:topic_name: TestTopic
|
data/test/message_test.rb
CHANGED
@@ -69,7 +69,6 @@ class JMSTest < Test::Unit::TestCase
|
|
69
69
|
should 'support setting persistence using symbols and the java constants' do
|
70
70
|
JMS::Connection.session(@config) do |session|
|
71
71
|
message = session.message('Hello World')
|
72
|
-
assert_equal message.jms_delivery_mode_sym, :non_persistent
|
73
72
|
message.jms_delivery_mode_sym = :non_persistent
|
74
73
|
assert_equal message.jms_delivery_mode_sym, :non_persistent
|
75
74
|
message.jms_delivery_mode_sym = :persistent
|
@@ -106,7 +105,7 @@ class JMSTest < Test::Unit::TestCase
|
|
106
105
|
JMS::Connection.session(@config) do |session|
|
107
106
|
assert_not_nil session
|
108
107
|
data = nil
|
109
|
-
session.producer(:queue_name =>
|
108
|
+
session.producer(:queue_name => @queue_name) do |producer|
|
110
109
|
message = session.message('Hello World')
|
111
110
|
message.jms_delivery_mode_sym = :persistent
|
112
111
|
assert_equal :persistent, message.jms_delivery_mode_sym
|
metadata
CHANGED
@@ -1,95 +1,169 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-jms
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
9
|
-
autorequire:
|
7
|
+
authors:
|
8
|
+
- Reid Morrison
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
date: 2012-10-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: gene_pool
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ! '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: !binary |-
|
21
|
+
MA==
|
22
|
+
none: false
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ! '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: !binary |-
|
28
|
+
MA==
|
29
|
+
none: false
|
30
|
+
prerelease: false
|
31
|
+
type: :runtime
|
17
32
|
description: JRuby-JMS is a Java and Ruby library that exposes the Java JMS API in a ruby friendly way. For JRuby only.
|
18
|
-
email:
|
33
|
+
email: reidmo@gmail.com
|
19
34
|
executables: []
|
20
|
-
|
21
35
|
extensions: []
|
22
|
-
|
23
36
|
extra_rdoc_files: []
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
37
|
+
files:
|
38
|
+
- !binary |-
|
39
|
+
R2VtZmlsZQ==
|
40
|
+
- !binary |-
|
41
|
+
R2VtZmlsZS5sb2Nr
|
42
|
+
- !binary |-
|
43
|
+
SElTVE9SWS5tZA==
|
44
|
+
- !binary |-
|
45
|
+
anJ1Ynktam1zLTAuMTEuMi5nZW0=
|
46
|
+
- !binary |-
|
47
|
+
TElDRU5TRS50eHQ=
|
48
|
+
- !binary |-
|
49
|
+
UmFrZWZpbGU=
|
50
|
+
- !binary |-
|
51
|
+
UkVBRE1FLm1k
|
52
|
+
- !binary |-
|
53
|
+
ZXhhbXBsZXMvam1zLnltbA==
|
54
|
+
- !binary |-
|
55
|
+
ZXhhbXBsZXMvYWR2YW5jZWQvc2Vzc2lvbl9wb29sLnJi
|
56
|
+
- !binary |-
|
57
|
+
ZXhhbXBsZXMvY2xpZW50LXNlcnZlci9yZXBsaWVyLnJi
|
58
|
+
- !binary |-
|
59
|
+
ZXhhbXBsZXMvY2xpZW50LXNlcnZlci9yZXF1ZXN0b3IucmI=
|
60
|
+
- !binary |-
|
61
|
+
ZXhhbXBsZXMvZmlsZS10by1xL2ZpbGVzX3RvX3EucmI=
|
62
|
+
- !binary |-
|
63
|
+
ZXhhbXBsZXMvZmlsZS10by1xL3FfdG9fZmlsZXMucmI=
|
64
|
+
- !binary |-
|
65
|
+
ZXhhbXBsZXMvaW52bS9pbnZtLnJi
|
66
|
+
- !binary |-
|
67
|
+
ZXhhbXBsZXMvaW52bS9sb2c0ai5wcm9wZXJ0aWVz
|
68
|
+
- !binary |-
|
69
|
+
ZXhhbXBsZXMvcGVyZm9ybWFuY2UvY29uc3VtZXIucmI=
|
70
|
+
- !binary |-
|
71
|
+
ZXhhbXBsZXMvcGVyZm9ybWFuY2UvcHJvZHVjZXIucmI=
|
72
|
+
- !binary |-
|
73
|
+
ZXhhbXBsZXMvcHJvZHVjZXItY29uc3VtZXIvYnJvd3Nlci5yYg==
|
74
|
+
- !binary |-
|
75
|
+
ZXhhbXBsZXMvcHJvZHVjZXItY29uc3VtZXIvY29uc3VtZXIucmI=
|
76
|
+
- !binary |-
|
77
|
+
ZXhhbXBsZXMvcHJvZHVjZXItY29uc3VtZXIvY29uc3VtZXJfYXN5bmMucmI=
|
78
|
+
- !binary |-
|
79
|
+
ZXhhbXBsZXMvcHJvZHVjZXItY29uc3VtZXIvcHJvZHVjZXIucmI=
|
80
|
+
- !binary |-
|
81
|
+
ZXhhbXBsZXMvcHVibGlzaC1zdWJzY3JpYmUvcHVibGlzaC5yYg==
|
82
|
+
- !binary |-
|
83
|
+
ZXhhbXBsZXMvcHVibGlzaC1zdWJzY3JpYmUvc3Vic2NyaWJlLnJi
|
84
|
+
- !binary |-
|
85
|
+
bGliL2ptcy5yYg==
|
86
|
+
- !binary |-
|
87
|
+
bGliL2ptcy9ieXRlc19tZXNzYWdlLnJi
|
88
|
+
- !binary |-
|
89
|
+
bGliL2ptcy9jb25uZWN0aW9uLnJi
|
90
|
+
- !binary |-
|
91
|
+
bGliL2ptcy9pbXBvcnRzLnJi
|
92
|
+
- !binary |-
|
93
|
+
bGliL2ptcy9sb2dnaW5nLnJi
|
94
|
+
- !binary |-
|
95
|
+
bGliL2ptcy9tYXBfbWVzc2FnZS5yYg==
|
96
|
+
- !binary |-
|
97
|
+
bGliL2ptcy9tZXNzYWdlLnJi
|
98
|
+
- !binary |-
|
99
|
+
bGliL2ptcy9tZXNzYWdlX2NvbnN1bWVyLnJi
|
100
|
+
- !binary |-
|
101
|
+
bGliL2ptcy9tZXNzYWdlX2xpc3RlbmVyX2ltcGwucmI=
|
102
|
+
- !binary |-
|
103
|
+
bGliL2ptcy9tZXNzYWdlX3Byb2R1Y2VyLnJi
|
104
|
+
- !binary |-
|
105
|
+
bGliL2ptcy9tcV93b3JrYXJvdW5kLnJi
|
106
|
+
- !binary |-
|
107
|
+
bGliL2ptcy9vYmplY3RfbWVzc2FnZS5yYg==
|
108
|
+
- !binary |-
|
109
|
+
bGliL2ptcy9vcmFjbGVfYV9xX2Nvbm5lY3Rpb25fZmFjdG9yeS5yYg==
|
110
|
+
- !binary |-
|
111
|
+
bGliL2ptcy9xdWV1ZV9icm93c2VyLnJi
|
112
|
+
- !binary |-
|
113
|
+
bGliL2ptcy9zZXNzaW9uLnJi
|
114
|
+
- !binary |-
|
115
|
+
bGliL2ptcy9zZXNzaW9uX3Bvb2wucmI=
|
116
|
+
- !binary |-
|
117
|
+
bGliL2ptcy90ZXh0X21lc3NhZ2UucmI=
|
118
|
+
- !binary |-
|
119
|
+
bGliL2ptcy92ZXJzaW9uLnJi
|
120
|
+
- !binary |-
|
121
|
+
bmJwcm9qZWN0L3ByaXZhdGUvY29uZmlnLnByb3BlcnRpZXM=
|
122
|
+
- !binary |-
|
123
|
+
bmJwcm9qZWN0L3ByaXZhdGUvcHJpdmF0ZS5wcm9wZXJ0aWVz
|
124
|
+
- !binary |-
|
125
|
+
bmJwcm9qZWN0L3ByaXZhdGUvcHJpdmF0ZS54bWw=
|
126
|
+
- !binary |-
|
127
|
+
bmJwcm9qZWN0L3ByaXZhdGUvcmFrZS1kLnR4dA==
|
128
|
+
- !binary |-
|
129
|
+
dGVzdC9jb25uZWN0aW9uX3Rlc3QucmI=
|
130
|
+
- !binary |-
|
131
|
+
dGVzdC9qbXMueW1s
|
132
|
+
- !binary |-
|
133
|
+
dGVzdC9sb2c0ai5wcm9wZXJ0aWVz
|
134
|
+
- !binary |-
|
135
|
+
dGVzdC9tZXNzYWdlX3Rlc3QucmI=
|
136
|
+
- !binary |-
|
137
|
+
dGVzdC9zZXNzaW9uX3Bvb2xfdGVzdC5yYg==
|
138
|
+
- !binary |-
|
139
|
+
dGVzdC9zZXNzaW9uX3Rlc3QucmI=
|
67
140
|
homepage: https://github.com/reidmorrison/jruby-jms
|
68
141
|
licenses: []
|
69
|
-
|
70
|
-
post_install_message:
|
142
|
+
post_install_message:
|
71
143
|
rdoc_options: []
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
segments:
|
151
|
+
- 0
|
152
|
+
hash: 2
|
153
|
+
version: !binary |-
|
154
|
+
MA==
|
76
155
|
none: false
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ! '>='
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: !binary |-
|
161
|
+
MA==
|
82
162
|
none: false
|
83
|
-
requirements:
|
84
|
-
- - ">="
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: "0"
|
87
163
|
requirements: []
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
signing_key:
|
164
|
+
rubyforge_project:
|
165
|
+
rubygems_version: 1.8.24
|
166
|
+
signing_key:
|
92
167
|
specification_version: 3
|
93
168
|
summary: JRuby interface into JMS
|
94
169
|
test_files: []
|
95
|
-
|