stomper 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -113
- data/lib/stomper.rb +4 -0
- data/lib/stomper/version.rb +2 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -1,114 +1,5 @@
|
|
1
|
-
#Stomper
|
1
|
+
#Stomper Deprecated
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
was written with Ruby 1.9.2 in mind, but will also work with Ruby 1.8.7, previous
|
7
|
-
versions of Ruby are not supported.
|
8
|
-
|
9
|
-
As the Stomp 1.1 specification is stabilizing, there should not be major
|
10
|
-
changes to this codebase once all of the features are fully implemented.
|
11
|
-
There is still a significant amount of work that must be done before this
|
12
|
-
gem is ready for any use. It can be used right now, but the API will be
|
13
|
-
rather unpleasant to deal with for common use cases.
|
14
|
-
|
15
|
-
This gem is in no way related to the [Python stomper](http://code.google.com/p/stomper/)
|
16
|
-
library.
|
17
|
-
|
18
|
-
##Example Usage
|
19
|
-
|
20
|
-
# Establish a connection to the broker
|
21
|
-
con = Stomper::Connection.open('stomp://host.example.com')
|
22
|
-
|
23
|
-
# Starts a receiver to read frames sent by the broker to the client.
|
24
|
-
# By default, this will create a new thread (once it is implemented)
|
25
|
-
con.start
|
26
|
-
|
27
|
-
# SUBSCRIBE to the '/queue/test' destination
|
28
|
-
con.subscribe('/queue/test') do |message|
|
29
|
-
con.ack(message)
|
30
|
-
puts "Message Received: #{message.body}"
|
31
|
-
end
|
32
|
-
|
33
|
-
# Deliver a SEND frame to the broker
|
34
|
-
con.send("/queue/test", "this is a tribute")
|
35
|
-
|
36
|
-
# A transaction in a block
|
37
|
-
con.with_transaction do |t|
|
38
|
-
t.send("/queue/test2", "first in a transaction")
|
39
|
-
t.send("/queue/test2", "second in a transaction")
|
40
|
-
# A transaction block is automatically finalized once the block
|
41
|
-
# finishes. If no exception is raised within the block, the transaction
|
42
|
-
# is committed, otherwise it is aborted.
|
43
|
-
end
|
44
|
-
|
45
|
-
# A 'free' transaction scope
|
46
|
-
trans = con.with_transaction
|
47
|
-
|
48
|
-
trans.send("/queue/other", "test message", { :'x-special-header' => 'marked'})
|
49
|
-
con.subscribe("/queue/other") do |m|
|
50
|
-
# Frame headers can be referenced by Symbol or String
|
51
|
-
if m['x-special-header'] == 'marked'
|
52
|
-
trans.ack(m)
|
53
|
-
# A 'free' transaction scope must be explicitly committed
|
54
|
-
trans.commit
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# A receipt scope
|
59
|
-
con.with_receipt do |r|
|
60
|
-
puts "Got receipt for SEND frame"
|
61
|
-
end.send("/queue/receipted", "this message will generate a receipt")
|
62
|
-
|
63
|
-
# A 'free' receipt scope
|
64
|
-
receipter = con.with_receipt { |r| puts "Got a receipt: #{r[:receipt-id]}" }
|
65
|
-
|
66
|
-
# Automatically generates a receipt ID.
|
67
|
-
receipter.subscribe("/topic/example")
|
68
|
-
# Or a receipt ID can be specified with a :receipt header value.
|
69
|
-
receipter.send("/queue/receipted", "also generates a receipt", :receipt => 'rcp-1234')
|
70
|
-
|
71
|
-
# Listen to some events
|
72
|
-
con.on_message do |frame|
|
73
|
-
puts "Incoming MESSAGE: #{frame.body}"
|
74
|
-
end
|
75
|
-
|
76
|
-
con.on_subscribe do |frame|
|
77
|
-
puts "Client is subscribing to #{frame[:destination]}"
|
78
|
-
end
|
79
|
-
|
80
|
-
con.after_transmitting do |frame|
|
81
|
-
puts "Client is transmitting #{frame.command}"
|
82
|
-
end
|
83
|
-
|
84
|
-
con.on_connection_terminated do
|
85
|
-
$stderr.puts "Connection terminated abnormally!"
|
86
|
-
end
|
87
|
-
|
88
|
-
##A Note About Encodings
|
89
|
-
|
90
|
-
The Stomp 1.1 specification encourages the use of a content-type header to
|
91
|
-
indicate both the media type of the body of a frame as well as its character
|
92
|
-
encoding (if the body is text.) Stomper, when used with Ruby 1.9, will do
|
93
|
-
much of the work for you in setting an appropriate charset provided you are
|
94
|
-
using its Encoding features properly. Ruby 1.8.7, however, lacks native String
|
95
|
-
encoding functionality. As such, it is up to you to set an appropriate charset
|
96
|
-
parameter for frames that have a body.
|
97
|
-
|
98
|
-
Further, frames read from a broker that include a content-type header with a
|
99
|
-
charset will have their bodies properly encoded in Ruby 1.9. In Ruby 1.8.7,
|
100
|
-
a frame's body will always be a string of bytes.
|
101
|
-
|
102
|
-
##License
|
103
|
-
|
104
|
-
Stomper is released under the Apache License 2.0 by Ian D. Eccles.
|
105
|
-
See LICENSE for full details.
|
106
|
-
|
107
|
-
##Thanks
|
108
|
-
|
109
|
-
* Lionel Cons -- Perl STOMP library -- lots of good suggestions and support
|
110
|
-
while I revised Stomper to support STOMP 1.1
|
111
|
-
* Brian McCallister and Johan Sørensen -- [Original STOMP ruby gem](http://gitorious.org/stomp) --
|
112
|
-
introduced me to the STOMP spec and started my work on this gem
|
113
|
-
* Hiram Chino and everyone on the stomp-spec mailing list for keeping the
|
114
|
-
Stomp 1.1 spec moving
|
3
|
+
This gem has been deprecated in favor of
|
4
|
+
[OnStomp](https://github.com/meadvillerb/onstomp). No new features or fixes
|
5
|
+
will be developed for +stomper+, so please migrate to +onstomp+!
|
data/lib/stomper.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
+
$stderr.puts "The gem has been deprecated, please use onstomp instead."
|
4
|
+
$stderr.puts "\t\tgem install onstomp"
|
5
|
+
$stderr.puts "See https://github.com/meadvillerb/onstomp for more information."
|
6
|
+
|
3
7
|
# For extensions to URI.parse for Stomp schemes.
|
4
8
|
require 'uri'
|
5
9
|
# Primarily for CGI.parse
|
data/lib/stomper/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: stomper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.0.
|
5
|
+
version: 2.0.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ian D. Eccles
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03
|
13
|
+
date: 2011-04-03 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
211
|
requirements: []
|
212
212
|
|
213
213
|
rubyforge_project: stomper
|
214
|
-
rubygems_version: 1.
|
214
|
+
rubygems_version: 1.6.2
|
215
215
|
signing_key:
|
216
216
|
specification_version: 3
|
217
217
|
summary: Client for message queues implementing the Stomp protocol interface.
|