jruby-jms 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/HISTORY.md +5 -0
  2. data/Rakefile +1 -1
  3. data/examples/invm/invm.rb +44 -0
  4. data/examples/invm/log4j.properties +58 -0
  5. data/examples/jms.yml +11 -9
  6. data/examples/producer-consumer/producer.rb +1 -1
  7. data/lib/jms/connection.rb +1 -0
  8. data/lib/jms/message_producer.rb +59 -0
  9. data/test/connection_test.rb +3 -0
  10. data/test/jms.yml +3 -1
  11. data/test/log4j.properties +32 -0
  12. metadata +6 -37
  13. data/doc/classes/JMS.html +0 -265
  14. data/doc/classes/JMS/BytesMessage.html +0 -215
  15. data/doc/classes/JMS/Connection.html +0 -1145
  16. data/doc/classes/JMS/MapMessage.html +0 -333
  17. data/doc/classes/JMS/Message.html +0 -1085
  18. data/doc/classes/JMS/MessageConsumer.html +0 -316
  19. data/doc/classes/JMS/MessageListenerImpl.html +0 -262
  20. data/doc/classes/JMS/ObjectMessage.html +0 -170
  21. data/doc/classes/JMS/OracleAQConnectionFactory.html +0 -184
  22. data/doc/classes/JMS/QueueBrowser.html +0 -155
  23. data/doc/classes/JMS/Session.html +0 -947
  24. data/doc/classes/JMS/SessionPool.html +0 -411
  25. data/doc/classes/JMS/TextMessage.html +0 -194
  26. data/doc/created.rid +0 -1
  27. data/doc/files/README_md.html +0 -440
  28. data/doc/files/lib/jms/bytes_message_rb.html +0 -122
  29. data/doc/files/lib/jms/connection_rb.html +0 -140
  30. data/doc/files/lib/jms/imports_rb.html +0 -108
  31. data/doc/files/lib/jms/logging_rb.html +0 -129
  32. data/doc/files/lib/jms/map_message_rb.html +0 -122
  33. data/doc/files/lib/jms/message_consumer_rb.html +0 -122
  34. data/doc/files/lib/jms/message_listener_impl_rb.html +0 -122
  35. data/doc/files/lib/jms/message_rb.html +0 -122
  36. data/doc/files/lib/jms/object_message_rb.html +0 -122
  37. data/doc/files/lib/jms/oracle_a_q_connection_factory_rb.html +0 -122
  38. data/doc/files/lib/jms/queue_browser_rb.html +0 -122
  39. data/doc/files/lib/jms/session_pool_rb.html +0 -108
  40. data/doc/files/lib/jms/session_rb.html +0 -164
  41. data/doc/files/lib/jms/text_message_rb.html +0 -122
  42. data/doc/files/lib/jms_rb.html +0 -131
  43. data/doc/fr_class_index.html +0 -39
  44. data/doc/fr_file_index.html +0 -42
  45. data/doc/fr_method_index.html +0 -120
  46. data/doc/index.html +0 -24
  47. data/doc/rdoc-style.css +0 -208
@@ -1 +0,0 @@
1
- Tue, 19 Apr 2011 10:13:57 -0400
@@ -1,440 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: README.md</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>README.md</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>README.md
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Mon Apr 18 10:06:20 -0400 2011</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <p>
73
- ## jruby-jms
74
- </p>
75
- <ul>
76
- <li><a
77
- href="http://github.com/reidmorrison/jruby-jms">github.com/reidmorrison/jruby-jms</a>
78
-
79
- </li>
80
- </ul>
81
- <p>
82
- ### Current Activities &amp; Backward Compatibility
83
- </p>
84
- <p>
85
- The API is relatively stable at this point and I do not expect any breaking
86
- changes at this point.
87
- </p>
88
- <p>
89
- There may still be some minor changes to the API to make things better
90
- and/or simpler. Once the code goes to V1.0.0 I will make every effort to
91
- not break the existing interface in any way.
92
- </p>
93
- <p>
94
- ### Feedback is welcome and appreciated :)
95
- </p>
96
- <p>
97
- ### Introduction
98
- </p>
99
- <p>
100
- jruby-jms attempts to &quot;rubify&quot; the Java <a
101
- href="../classes/JMS.html">JMS</a> API without compromising performance. It
102
- does this by sprinkling &quot;Ruby-goodness&quot; into the existing <a
103
- href="../classes/JMS.html">JMS</a> Java interfaces, I.e. By adding Ruby
104
- methods to the existing classes and interfaces. Since jruby-jms exposes the
105
- <a href="../classes/JMS.html">JMS</a> Java classes directly there is no
106
- performance impact that would have been introduced had the entire API been
107
- wrapped in a Ruby layer.
108
- </p>
109
- <p>
110
- In this way, using regular Ruby constructs a Ruby program can easily
111
- interact with <a href="../classes/JMS.html">JMS</a> in a highly performant
112
- way. Also, in this way you are not limited to whatever the Ruby wrapper
113
- would have exposed, since the entire <a href="../classes/JMS.html">JMS</a>
114
- API is available to you at any time.
115
- </p>
116
- <p>
117
- The initial internal use version of JRuby-<a
118
- href="../classes/JMS.html">JMS</a> was created in 2008. It has been in use
119
- in production since 2009.
120
- </p>
121
- <p>
122
- ### Install
123
- </p>
124
- <pre>
125
- jgem install jruby-jms
126
- </pre>
127
- <p>
128
- ### Simplification
129
- </p>
130
- <p>
131
- One of the difficulties with the regular <a
132
- href="../classes/JMS.html">JMS</a> API is that it use completely separate
133
- classes for Topics and Queues in <a href="../classes/JMS.html">JMS</a> 1.1.
134
- This means that once a program writes to a Queue for example, that without
135
- changing the program it could not be changed to write to a topic. Also a
136
- consumer on a topic or a queue are identical. jruby-jms fixes this issue by
137
- allowing you to have a Consumer or Producer that is independent of whether
138
- it is producing or consuming to/from or a Topic or a Queue. The complexity
139
- of which <a href="../classes/JMS.html">JMS</a> class is used is taken care
140
- of by jruby-jms.
141
- </p>
142
- <p>
143
- ## Concepts &amp; Terminology
144
- </p>
145
- <p>
146
- ### Java Message Service (<a href="../classes/JMS.html">JMS</a>) API
147
- </p>
148
- <p>
149
- The <a href="../classes/JMS.html">JMS</a> API is a standard interface part
150
- of Java EE 6 as a way for programs to send and receive messages through a
151
- messaging and queuing system.
152
- </p>
153
- <p>
154
- For more information on the <a href="../classes/JMS.html">JMS</a> API: <a
155
- href="http://download.oracle.com/javaee/6/api/index.html?javax/jms/package-summary.html">download.oracle.com/javaee/6/api/index.html?javax/jms/package-summary.html</a>
156
- </p>
157
- <p>
158
- ### Broker / Queue Manager
159
- </p>
160
- <p>
161
- Depending on which <a href="../classes/JMS.html">JMS</a> provider you are
162
- using they refer to their centralized server as either a Broker or Queue
163
- Manager. The Broker or Queue Manager is the centralized &quot;server&quot;
164
- through which all messages pass through.
165
- </p>
166
- <p>
167
- Some Brokers support an in-vm broker instance so that messages can be
168
- passed between producers and consumers within the same Java Virtual Machine
169
- (JVM) instance. This removes the need to make any network calls. Highly
170
- recommended for passing messages between threads in the same JVM.
171
- </p>
172
- <p>
173
- ### Connection
174
- </p>
175
- <p>
176
- In order to connect to any broker the Client <a
177
- href="../classes/JMS.html">JMS</a> application must create a connection. In
178
- traditional <a href="../classes/JMS.html">JMS</a> a ConnectionFactory is
179
- used to create connections. In jruby-jms the <a
180
- href="../classes/JMS/Connection.html">JMS::Connection</a> takes care of the
181
- complexities of dealing with the factory class, just pass the required
182
- parameters to Connection.new at it takes care of the rest.
183
- </p>
184
- <p>
185
- ### Queue
186
- </p>
187
- <p>
188
- A queue used for holding messages. The queue is defined prior to the
189
- message being sent and is used to hold the messages. The consumer does not
190
- have to be running in order to receive messages.
191
- </p>
192
- <p>
193
- ### Topic
194
- </p>
195
- <p>
196
- Instead of sending messages to a single queue, a topic can be used to
197
- publish messages and allow multiple consumers to register for messages that
198
- match the topic they are interested in
199
- </p>
200
- <p>
201
- ### Producer
202
- </p>
203
- <p>
204
- Producers write messages to queues or topics
205
- </p>
206
- <p>
207
- ActiveMQ Example:
208
- </p>
209
- <pre>
210
- require 'rubygems'
211
- require 'jms'
212
-
213
- # Connect to ActiveMQ
214
- config = {
215
- :factory =&gt; 'org.apache.activemq.ActiveMQConnectionFactory',
216
- :broker_url =&gt; 'tcp://localhost:61616',
217
- :require_jars =&gt; [
218
- &quot;~/Applications/apache-activemq-5.5.0/activemq-all-5.5.0.jar&quot;,
219
- &quot;~/Applications/apache-activemq-5.5.0/lib/optional/slf4j-log4j12-1.5.11.jar&quot;,
220
- &quot;~/Applications/apache-activemq-5.5.0/lib/optional/log4j-1.2.14.jar&quot;
221
- ]
222
- }
223
-
224
- JMS::Connection.session(config) do |session|
225
- session.producer(:queue_name =&gt; 'ExampleQueue') do |producer|
226
- producer.send(session.message(&quot;Hello World&quot;))
227
- end
228
- end
229
- </pre>
230
- <p>
231
- ### Consumer
232
- </p>
233
- <p>
234
- Consumers read message from a queue or topic
235
- </p>
236
- <p>
237
- ActiveMQ Example:
238
- </p>
239
- <pre>
240
- require 'rubygems'
241
- require 'jms'
242
-
243
- # Connect to ActiveMQ
244
- config = {
245
- :factory =&gt; 'org.apache.activemq.ActiveMQConnectionFactory',
246
- :broker_url =&gt; 'tcp://localhost:61616',
247
- :require_jars =&gt; [&quot;~/Applications/apache-activemq-5.4.2/activemq-all-5.4.2.jar&quot;]
248
- }
249
-
250
- JMS::Connection.session(config) do |session|
251
- session.consume(:queue_name =&gt; 'ExampleQueue', :timeout=&gt;1000) do |message|
252
- p message
253
- end
254
- end
255
- </pre>
256
- <p>
257
- ## Overview
258
- </p>
259
- <p>
260
- jruby-jms is a complete JRuby API into the Java Messaging Specification (<a
261
- href="../classes/JMS.html">JMS</a>) V1.1 followed by several <a
262
- href="../classes/JMS.html">JMS</a> Providers.
263
- </p>
264
- <p>
265
- ## Threading
266
- </p>
267
- <p>
268
- A <a href="../classes/JMS/Connection.html">JMS::Connection</a> instance can
269
- be shared between threads, whereas a session, consumer, producer, and any
270
- artifacts created by the session should only be used by one thread at a
271
- time.
272
- </p>
273
- <p>
274
- For consumers, it is recommended to create a session for each thread and
275
- leave that thread blocked on Consumer.receive. Or, even better use
276
- Connection.on_message which will create a session, within which any message
277
- received from the specified queue or topic match will be passed to the
278
- block.
279
- </p>
280
- <p>
281
- ## Logging
282
- </p>
283
- <p>
284
- jruby-jms detects the logging available in the current environment. When
285
- running under Rails it will use the Rails logger, otherwise the standard
286
- Ruby logger. The logger can also be replaced by calling Connection.logger=
287
- </p>
288
- <p>
289
- ## Dependencies
290
- </p>
291
- <p>
292
- ### <a href="../classes/JMS.html">JMS</a> V1.1 Provider
293
- </p>
294
- <p>
295
- In order to communicate with a <a href="../classes/JMS.html">JMS</a> V 1.1
296
- provider jruby-jms needs the jar files supplied by the <a
297
- href="../classes/JMS.html">JMS</a> provider. As in the examples above the
298
- jar files can be specified in the configuration element :require_jars.
299
- Otherwise, the jars must be explicitly required in the Ruby code:
300
- </p>
301
- <pre>
302
- `require &quot;~/Applications/apache-activemq-5.4.2/activemq-all-5.4.2.jar&quot;`
303
- </pre>
304
- <p>
305
- ### JRuby
306
- </p>
307
- <p>
308
- jruby-jms has been tested against JRuby 1.5.1 and 1.6.1, but should work
309
- with any current JRuby version.
310
- </p>
311
- <p>
312
- ## Development
313
- </p>
314
- <p>
315
- Want to contribute to jruby-jms?
316
- </p>
317
- <p>
318
- First clone the repo and run the tests:
319
- </p>
320
- <pre>
321
- git clone git://github.com/reidmorrison/jruby-jms.git
322
- cd jruby-jms
323
- jruby -S rake test
324
- </pre>
325
- <p>
326
- Feel free to submit any issues and we&#8216;ll try to resolve it.
327
- </p>
328
- <p>
329
- ## Contributing
330
- </p>
331
- <p>
332
- Once you&#8216;ve made your great commits:
333
- </p>
334
- <ol>
335
- <li>[Fork](<a
336
- href="http://help.github.com/forking">help.github.com/forking</a>/)
337
- jruby-jms
338
-
339
- </li>
340
- <li>Create a topic branch - `git checkout -b my_branch`
341
-
342
- </li>
343
- <li>Push to your branch - `git push origin my_branch`
344
-
345
- </li>
346
- <li>Create an [Issue](<a
347
- href="http://github.com/reidmorrison/jruby-jms/issues">github.com/reidmorrison/jruby-jms/issues</a>)
348
- with a link to your branch
349
-
350
- </li>
351
- <li>That&#8216;s it!
352
-
353
- </li>
354
- </ol>
355
- <p>
356
- ## Meta
357
- </p>
358
- <ul>
359
- <li>Code: `git clone git://github.com/reidmorrison/jruby-jms.git`
360
-
361
- </li>
362
- <li>Home: &lt;<a
363
- href="http://github.com/reidmorrison/jruby-jms">github.com/reidmorrison/jruby-jms</a>&gt;
364
-
365
- </li>
366
- <li>Bugs: &lt;<a
367
- href="http://github.com/reidmorrison/jruby-jms/issues">github.com/reidmorrison/jruby-jms/issues</a>&gt;
368
-
369
- </li>
370
- <li>Gems: &lt;<a
371
- href="http://rubygems.org/gems/jruby-jms">rubygems.org/gems/jruby-jms</a>&gt;
372
-
373
- </li>
374
- </ul>
375
- <p>
376
- This project uses [Semantic Versioning](<a
377
- href="http://semver.org">semver.org</a>/).
378
- </p>
379
- <p>
380
- ## Author
381
- </p>
382
- <table>
383
- <tr><td valign="top">Reid Morrison :: rubywmq@gmail.com :</td><td>@reidmorrison
384
-
385
- </td></tr>
386
- </table>
387
- <p>
388
- ## License
389
- </p>
390
- <p>
391
- Copyright 2008 - 2011 J. Reid Morrison
392
- </p>
393
- <p>
394
- Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
395
- you may not use this file except in compliance with the License. You may
396
- obtain a copy of the License at
397
- </p>
398
- <pre>
399
- http://www.apache.org/licenses/LICENSE-2.0
400
- </pre>
401
- <p>
402
- Unless required by applicable law or agreed to in writing, software
403
- distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
404
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
405
- See the License for the specific language governing permissions and
406
- limitations under the License.
407
- </p>
408
-
409
- </div>
410
-
411
-
412
- </div>
413
-
414
-
415
- </div>
416
-
417
-
418
- <!-- if includes -->
419
-
420
- <div id="section">
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-
429
- <!-- if method_list -->
430
-
431
-
432
- </div>
433
-
434
-
435
- <div id="validator-badges">
436
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
437
- </div>
438
-
439
- </body>
440
- </html>
@@ -1,122 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: bytes_message.rb</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>bytes_message.rb</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>lib/jms/bytes_message.rb
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Fri Apr 15 15:56:42 -0400 2011</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <p>
73
- Copyright 2008, 2009, 2010, 2011 J. Reid Morrison
74
- </p>
75
- <p>
76
- Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
77
- you may not use this file except in compliance with the License. You may
78
- obtain a copy of the License at
79
- </p>
80
- <pre>
81
- http://www.apache.org/licenses/LICENSE-2.0
82
- </pre>
83
- <p>
84
- Unless required by applicable law or agreed to in writing, software
85
- distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
86
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
87
- See the License for the specific language governing permissions and
88
- limitations under the License.
89
- </p>
90
-
91
- </div>
92
-
93
-
94
- </div>
95
-
96
-
97
- </div>
98
-
99
-
100
- <!-- if includes -->
101
-
102
- <div id="section">
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
- <!-- if method_list -->
112
-
113
-
114
- </div>
115
-
116
-
117
- <div id="validator-badges">
118
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
119
- </div>
120
-
121
- </body>
122
- </html>