jruby-jms 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +30 -66
- data/Rakefile +1 -1
- data/lib/jms/connection.rb +3 -2
- data/test/message_test.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
jruby-jms
|
2
|
-
=========
|
1
|
+
## jruby-jms
|
3
2
|
|
4
3
|
* http://github.com/reidmorrison/jruby-jms
|
5
4
|
|
6
5
|
### Current Activities & Backward Compatibility
|
7
6
|
|
8
|
-
Please read the source files for now
|
9
|
-
generation issue.
|
7
|
+
Please read the documentation in the source files for now. Currently looking
|
8
|
+
into the rdoc doc generation issue for JRuby extended Java interfaces and classes.
|
10
9
|
|
11
10
|
There may still be some changes to the API to make things better and/or simpler.
|
12
|
-
|
13
11
|
Once the code goes to V1.0.0 I will make every effort to not break the
|
14
12
|
existing interface in any way.
|
15
13
|
|
@@ -41,7 +39,7 @@ API is available to you at any time.
|
|
41
39
|
|
42
40
|
### Install
|
43
41
|
|
44
|
-
|
42
|
+
jgem install jruby-jms
|
45
43
|
|
46
44
|
### Simplification
|
47
45
|
|
@@ -54,8 +52,7 @@ or Producer that is independent of whether it is producing or consuming to/from
|
|
54
52
|
or a Topic or a Queue. The complexity of which JMS class is used is taken care
|
55
53
|
of by jruby-jms.
|
56
54
|
|
57
|
-
Concepts & Terminology
|
58
|
-
----------------------
|
55
|
+
## Concepts & Terminology
|
59
56
|
|
60
57
|
### Java Message Service (JMS) API
|
61
58
|
|
@@ -97,12 +94,10 @@ topic they are interested in
|
|
97
94
|
|
98
95
|
### Producer
|
99
96
|
|
100
|
-
Producers write
|
97
|
+
Producers write messages to queues or topics
|
101
98
|
|
102
99
|
ActiveMQ Example:
|
103
100
|
require 'rubygems'
|
104
|
-
|
105
|
-
# Include JMS after ActiveMQ
|
106
101
|
require 'jms'
|
107
102
|
|
108
103
|
# Connect to ActiveMQ
|
@@ -113,7 +108,7 @@ ActiveMQ Example:
|
|
113
108
|
}
|
114
109
|
|
115
110
|
JMS::Connection.session(config) do |session|
|
116
|
-
session.producer(:
|
111
|
+
session.producer(:queue_name => 'ExampleQueue') do |producer|
|
117
112
|
producer.send(session.message("Hello World"))
|
118
113
|
end
|
119
114
|
end
|
@@ -124,8 +119,6 @@ Consumers read message from a queue or topic
|
|
124
119
|
|
125
120
|
ActiveMQ Example:
|
126
121
|
require 'rubygems'
|
127
|
-
|
128
|
-
# Include JMS after ActiveMQ
|
129
122
|
require 'jms'
|
130
123
|
|
131
124
|
# Connect to ActiveMQ
|
@@ -136,22 +129,17 @@ ActiveMQ Example:
|
|
136
129
|
}
|
137
130
|
|
138
131
|
JMS::Connection.session(config) do |session|
|
139
|
-
session.consume(:
|
132
|
+
session.consume(:queue_name => 'ExampleQueue', :timeout=>1000) do |message|
|
140
133
|
p message
|
141
134
|
end
|
142
135
|
end
|
143
136
|
|
144
|
-
Overview
|
145
|
-
--------
|
137
|
+
## Overview
|
146
138
|
|
147
139
|
jruby-jms is a complete JRuby API into the Java Messaging Specification (JMS)
|
148
140
|
followed by many JMS Providers.
|
149
141
|
|
150
|
-
|
151
|
-
CLASSPATH that are supplied by the JMS Provider.
|
152
|
-
|
153
|
-
Threading
|
154
|
-
---------
|
142
|
+
## Threading
|
155
143
|
|
156
144
|
A JMS::Connection instance can be shared between threads, whereas a session,
|
157
145
|
consumer, producer, and any artifacts created by the session should only be
|
@@ -162,31 +150,28 @@ that thread blocked on Consumer.receive. Or, even better use Connection.on_messa
|
|
162
150
|
which will create a session, within which any message received from the specified
|
163
151
|
queue or topic match will be passed to the block.
|
164
152
|
|
165
|
-
|
166
|
-
|
167
|
-
Logging
|
168
|
-
-------
|
153
|
+
## Logging
|
169
154
|
|
170
155
|
jruby-jms detects the logging available in the current environment.
|
171
156
|
When running under Rails it will use the Rails logger, otherwise the standard
|
172
157
|
Ruby logger. The logger can also be replaced by calling Connection.logger=
|
173
158
|
|
174
|
-
Dependencies
|
175
|
-
|
159
|
+
## Dependencies
|
160
|
+
|
161
|
+
### JMS V1.1 Provider
|
162
|
+
|
163
|
+
In order to communicate with a JMS V 1.1 provider jruby-jms needs the jar files supplied
|
164
|
+
by the JMS provider. As in the examples above the jar files can be specified in
|
165
|
+
the configuration element :require_jars. Otherwise, the jars must be explicitly
|
166
|
+
required in the Ruby code:
|
167
|
+
`require "~/Applications/apache-activemq-5.4.2/activemq-all-5.4.2.jar"`
|
176
168
|
|
177
169
|
### JRuby
|
178
170
|
|
179
171
|
jruby-jms has been tested against JRuby 1.5.1 and 1.6, but should work with any
|
180
172
|
current JRuby version.
|
181
173
|
|
182
|
-
|
183
|
-
|
184
|
-
Every JMS Provider has details on which jar files to include in your CLASSPATH
|
185
|
-
for their JMS client to work. Some examples for connection settings are covered
|
186
|
-
in the Connection.new documentation
|
187
|
-
|
188
|
-
Development
|
189
|
-
-----------
|
174
|
+
## Development
|
190
175
|
|
191
176
|
Want to contribute to jruby-jms?
|
192
177
|
|
@@ -196,53 +181,32 @@ First clone the repo and run the tests:
|
|
196
181
|
cd jruby-jms
|
197
182
|
jruby -S rake test
|
198
183
|
|
199
|
-
Feel free to
|
200
|
-
|
184
|
+
Feel free to submit any issues and we'll try to resolve it.
|
201
185
|
|
202
|
-
Contributing
|
203
|
-
------------
|
186
|
+
## Contributing
|
204
187
|
|
205
188
|
Once you've made your great commits:
|
206
189
|
|
207
|
-
1. [Fork]
|
190
|
+
1. [Fork](http://help.github.com/forking/) jruby-jms
|
208
191
|
2. Create a topic branch - `git checkout -b my_branch`
|
209
192
|
3. Push to your branch - `git push origin my_branch`
|
210
|
-
4. Create an [Issue]
|
193
|
+
4. Create an [Issue](http://github.com/reidmorrison/jruby-jms/issues) with a link to your branch
|
211
194
|
5. That's it!
|
212
195
|
|
213
|
-
|
214
|
-
on coding standards, new features, etc.
|
215
|
-
|
216
|
-
|
217
|
-
Mailing List
|
218
|
-
------------
|
219
|
-
|
220
|
-
TBA
|
221
|
-
|
222
|
-
Meta
|
223
|
-
----
|
196
|
+
## Meta
|
224
197
|
|
225
198
|
* Code: `git clone git://github.com/reidmorrison/jruby-jms.git`
|
226
199
|
* Home: <http://github.com/reidmorrison/jruby-jms>
|
227
|
-
* Docs: <http://jruby-jms.github.com/jruby-jms/>
|
228
200
|
* Bugs: <http://github.com/reidmorrison/jruby-jms/issues>
|
229
|
-
*
|
230
|
-
* Gems: <http://gemcutter.org/gems/jruby-jms>
|
201
|
+
* Gems: <http://rubygems.org/gems/jruby-jms>
|
231
202
|
|
232
|
-
This project uses [Semantic Versioning]
|
203
|
+
This project uses [Semantic Versioning](http://semver.org/).
|
233
204
|
|
234
|
-
|
235
|
-
Author
|
236
|
-
------
|
205
|
+
## Author
|
237
206
|
|
238
207
|
Reid Morrison :: rubywmq@gmail.com :: @reidmorrison
|
239
208
|
|
240
|
-
|
241
|
-
[2]: http://github.com/reidmorrison/jruby-jms/issues
|
242
|
-
[sv]: http://semver.org/
|
243
|
-
|
244
|
-
License
|
245
|
-
-------
|
209
|
+
## License
|
246
210
|
|
247
211
|
Copyright 2008 - 2011 J. Reid Morrison
|
248
212
|
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ desc "Build gem"
|
|
9
9
|
task :gem do |t|
|
10
10
|
gemspec = Gem::Specification.new do |s|
|
11
11
|
s.name = 'jruby-jms'
|
12
|
-
s.version = '0.10.
|
12
|
+
s.version = '0.10.2'
|
13
13
|
s.author = 'Reid Morrison'
|
14
14
|
s.email = 'rubywmq@gmail.com'
|
15
15
|
s.homepage = 'https://github.com/reidmorrison/jruby-jms'
|
data/lib/jms/connection.rb
CHANGED
@@ -107,7 +107,8 @@ module JMS
|
|
107
107
|
rescue Exception => exc
|
108
108
|
JMS::logger.error "Failed to Load Jar File:#{jar}. #{exc.to_s}"
|
109
109
|
end
|
110
|
-
end
|
110
|
+
end if jar_list
|
111
|
+
|
111
112
|
require 'jms/message_listener'
|
112
113
|
require 'jms/javax_jms_message'
|
113
114
|
require 'jms/javax_jms_text_message'
|
@@ -223,7 +224,7 @@ module JMS
|
|
223
224
|
|
224
225
|
# Load Jar files on demand so that they do not need to be in the CLASSPATH
|
225
226
|
# of JRuby lib directory
|
226
|
-
fetch_dependencies(params[:require_jars])
|
227
|
+
fetch_dependencies(params[:require_jars])
|
227
228
|
|
228
229
|
connection_factory = nil
|
229
230
|
factory = params[:factory]
|
data/test/message_test.rb
CHANGED
@@ -43,7 +43,7 @@ class JMSTest < Test::Unit::TestCase
|
|
43
43
|
should 'produce, browse and consume messages to/from a queue' do
|
44
44
|
JMS::Connection.session(@config) do |session|
|
45
45
|
assert_not_nil session
|
46
|
-
data =
|
46
|
+
data = :timed_out
|
47
47
|
browse_data = nil
|
48
48
|
session.producer(:queue_name => @queue_name) do |producer|
|
49
49
|
# Send Message
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 10
|
8
|
-
-
|
9
|
-
version: 0.10.
|
8
|
+
- 2
|
9
|
+
version: 0.10.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Reid Morrison
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02-
|
17
|
+
date: 2011-02-23 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|