onstomp 1.0.0 → 1.0.1
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.
- data/.gitignore +4 -0
- data/.yardopts +2 -1
- data/Rakefile +147 -0
- data/extra_doc/API.md +491 -0
- data/extra_doc/API.md.erb +33 -0
- data/extra_doc/DeveloperNarrative.md +123 -0
- data/extra_doc/UserNarrative.md +511 -0
- data/lib/onstomp.rb +5 -5
- data/lib/onstomp/client.rb +6 -1
- data/lib/onstomp/components/frame.rb +6 -6
- data/lib/onstomp/components/frame_headers.rb +18 -18
- data/lib/onstomp/components/scopes/transaction_scope.rb +11 -11
- data/lib/onstomp/components/subscription.rb +2 -2
- data/lib/onstomp/components/threaded_processor.rb +1 -1
- data/lib/onstomp/components/uri.rb +1 -1
- data/lib/onstomp/connections/base.rb +5 -5
- data/lib/onstomp/connections/heartbeating.rb +2 -2
- data/lib/onstomp/connections/serializers/stomp_1.rb +6 -6
- data/lib/onstomp/connections/serializers/stomp_1_1.rb +2 -2
- data/lib/onstomp/connections/stomp_1_0.rb +1 -1
- data/lib/onstomp/connections/stomp_1_1.rb +1 -1
- data/lib/onstomp/failover.rb +4 -0
- data/lib/onstomp/failover/buffers.rb +1 -0
- data/lib/onstomp/failover/buffers/receipts.rb +101 -0
- data/lib/onstomp/failover/buffers/written.rb +2 -2
- data/lib/onstomp/failover/client.rb +15 -12
- data/lib/onstomp/failover/failover_configurable.rb +3 -3
- data/lib/onstomp/failover/pools/base.rb +1 -1
- data/lib/onstomp/failover/uri.rb +41 -16
- data/lib/onstomp/interfaces/client_configurable.rb +1 -1
- data/lib/onstomp/interfaces/client_events.rb +30 -11
- data/lib/onstomp/interfaces/connection_events.rb +5 -1
- data/lib/onstomp/interfaces/event_manager.rb +2 -2
- data/lib/onstomp/interfaces/frame_methods.rb +169 -8
- data/lib/onstomp/interfaces/uri_configurable.rb +3 -3
- data/lib/onstomp/open-uri/client_extensions.rb +4 -4
- data/lib/onstomp/version.rb +2 -2
- data/onstomp.gemspec +0 -1
- data/spec/onstomp/components/threaded_processor_spec.rb +21 -0
- data/spec/onstomp/connections/base_spec.rb +15 -0
- data/spec/onstomp/failover/buffers/receipts_spec.rb +189 -0
- data/spec/onstomp/failover/buffers/written_spec.rb +167 -1
- data/spec/onstomp/failover/client_spec.rb +70 -1
- data/spec/onstomp/failover/failover_events_spec.rb +1 -2
- data/spec/onstomp/failover/uri_spec.rb +37 -4
- data/spec/onstomp/full_stacks/failover_spec.rb +76 -25
- data/spec/onstomp/full_stacks/onstomp_spec.rb +52 -8
- data/spec/onstomp/full_stacks/onstomp_ssh_spec.rb +83 -0
- data/spec/onstomp/full_stacks/test_broker.rb +45 -29
- metadata +11 -15
- data/DeveloperNarrative.md +0 -15
- data/UserNarrative.md +0 -8
@@ -6,6 +6,7 @@ module OnStomp::Interfaces::ConnectionEvents
|
|
6
6
|
|
7
7
|
# @group Connection State Events
|
8
8
|
|
9
|
+
# @api gem:1 STOMP:1.0,1.1
|
9
10
|
# Binds a callback to be invoked when a connection has been fully
|
10
11
|
# established between broker and client.
|
11
12
|
# @yield [client, connection] callback invoked when event is triggered
|
@@ -13,6 +14,7 @@ module OnStomp::Interfaces::ConnectionEvents
|
|
13
14
|
# @yieldparam [OnStomp::Connections::Base] connection that triggered
|
14
15
|
# the event (in general the same as +client.connection+)
|
15
16
|
create_event_methods :established, :on
|
17
|
+
# @api gem:1 STOMP:1.1
|
16
18
|
# Binds a callback to be invoked when a connection has been died due to
|
17
19
|
# insufficient data transfer.
|
18
20
|
# @note Only applies to STOMP 1.1 connections with heartbeating enabled.
|
@@ -21,6 +23,7 @@ module OnStomp::Interfaces::ConnectionEvents
|
|
21
23
|
# @yieldparam [OnStomp::Connections::Base] connection that triggered
|
22
24
|
# the event (in general the same as +client.connection+)
|
23
25
|
create_event_methods :died, :on
|
26
|
+
# @api gem:1 STOMP:1.0,1.1
|
24
27
|
# Binds a callback to be invoked when a connection has been terminated
|
25
28
|
# (eg: closed unexpectedly due to an exception)
|
26
29
|
# @yield [client, connection] callback invoked when event is triggered
|
@@ -28,6 +31,7 @@ module OnStomp::Interfaces::ConnectionEvents
|
|
28
31
|
# @yieldparam [OnStomp::Connections::Base] connection that triggered
|
29
32
|
# the event (in general the same as +client.connection+)
|
30
33
|
create_event_methods :terminated, :on
|
34
|
+
# @api gem:1 STOMP:1.0,1.1
|
31
35
|
# Binds a callback to be invoked when a connection has been closed, either
|
32
36
|
# through a graceful disconnect or unexpectedly.
|
33
37
|
# @note If connection is closed unexpectedly, {#on_died} is triggered first,
|
@@ -47,7 +51,7 @@ module OnStomp::Interfaces::ConnectionEvents
|
|
47
51
|
end
|
48
52
|
|
49
53
|
# Takes a hash of event bindings a {OnStomp::Client client} has stored
|
50
|
-
# and binds them to this connection, then triggers
|
54
|
+
# and binds them to this connection, then triggers `on_established`.
|
51
55
|
# This allows users to add callbacks for
|
52
56
|
# connection events before the connection exist and have said callbacks
|
53
57
|
# installed once the connection is created.
|
@@ -7,7 +7,7 @@ module OnStomp::Interfaces::EventManager
|
|
7
7
|
base.extend ClassMethods
|
8
8
|
end
|
9
9
|
|
10
|
-
# Binds a
|
10
|
+
# Binds a `Proc` to be invoked when the given `event_name` is triggered.
|
11
11
|
# @param [Symbol] event_name
|
12
12
|
# @param [Proc] cb_proc
|
13
13
|
# @return [self]
|
@@ -23,7 +23,7 @@ module OnStomp::Interfaces::EventManager
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# Triggers an event by the given name, passing along any additional
|
26
|
-
#
|
26
|
+
# `args` as parameters to the callback
|
27
27
|
# @param [Symbol] event_name event to trigger
|
28
28
|
# @param [Object, Object, ...] args
|
29
29
|
def trigger_event(event_name, *args)
|
@@ -3,6 +3,22 @@
|
|
3
3
|
# Mixin for {OnStomp::Client clients} to provide methods that create
|
4
4
|
# and transmit STOMP {OnStomp::Components::Frame frames}.
|
5
5
|
module OnStomp::Interfaces::FrameMethods
|
6
|
+
# I'm using @api tags in here to provide a bit of data, here's the format:
|
7
|
+
# gem:<major version>[,<major version>,...] STOMP:<version>[,<version>,...]
|
8
|
+
# The first chunk indicates the MAJOR versions of the OnStomp gem that support
|
9
|
+
# the method. The second chunk indicates the STOMP protocol versions that
|
10
|
+
# support the frame generated by this method. A single '*' after the STOMP
|
11
|
+
# versions indicates that there are minor changes between protocols
|
12
|
+
# (eg: new acceptable values for an optional header.) A single '!' after
|
13
|
+
# the STOMP versions indicates that there are major changes between protocols
|
14
|
+
# (eg: a new header is required, as with ACK) indicating that some ways of
|
15
|
+
# calling the method may produce errors with newer versions of the STOMP
|
16
|
+
# protocol. All other text after the severity markers is for my own reference
|
17
|
+
# to remind me of the changes. These API tags will be queried and put into
|
18
|
+
# a document to provide a quick reference of changes between protocols or
|
19
|
+
# major gem versions for end users.
|
20
|
+
|
21
|
+
# @api gem:1 STOMP:1.0,1.1
|
6
22
|
# Transmits a SEND frame generated by the client's connection
|
7
23
|
# @param [String] dest destination for the frame
|
8
24
|
# @param [String] body body of the frame
|
@@ -14,11 +30,38 @@ module OnStomp::Interfaces::FrameMethods
|
|
14
30
|
# @yieldparam [OnStomp::Components::Frame] receipt RECEIPT for the frame
|
15
31
|
# @raise OnStomp::UnsupportedCommandError if the connection does not support
|
16
32
|
# SEND frames
|
33
|
+
# @option headers [String] :'content-type' The content type of the SEND
|
34
|
+
# frame's body. If the body is text (ie: has a non-binary `encoding`)
|
35
|
+
# `onstomp` will set the :'content-type' header to 'text/plain' if it
|
36
|
+
# has not been set. See {file:docs/Encodings.md Encodings} for more
|
37
|
+
# details.
|
38
|
+
# @option headers [String] :receipt A receipt ID for the frame, this
|
39
|
+
# will be matched by the :'receipt-id' header in the broker's RECEIPT
|
40
|
+
# response.
|
41
|
+
# @option headers [String] :transaction The ID of an existing transaction
|
42
|
+
# to add this frame to.
|
43
|
+
# @option headers [String] :'content-length' If you set this header, it
|
44
|
+
# will be overwritten, so save your fingers from a few keystrokes by not
|
45
|
+
# setting it. All SEND frames generated by `onstomp` will have a
|
46
|
+
# :'content-length' header.
|
47
|
+
# @example
|
48
|
+
# # Transmit a simple SEND frame to the broker
|
49
|
+
# client.send '/queue/example', 'Hello STOMP'
|
50
|
+
#
|
51
|
+
# # Everything's better with umlauts.
|
52
|
+
# client.send '/topic/example', "Hëllo Wörld",
|
53
|
+
# :'content-type' => 'text/plain;charset=UTF-8'
|
54
|
+
#
|
55
|
+
# # Get a receipt for the SEND frame
|
56
|
+
# client.send '/queue/example', "Did you get that thing I sent you?" do |r|
|
57
|
+
# puts "The broker received our SEND frame"
|
58
|
+
# end
|
17
59
|
def send dest, body, headers={}, &cb
|
18
60
|
transmit connection.send_frame(dest, body, headers), :receipt => cb
|
19
61
|
end
|
20
62
|
alias :puts :send
|
21
63
|
|
64
|
+
# @api gem:1 STOMP:1.0,1.1* [+ack:client-individual]
|
22
65
|
# Transmits a SUBSCRIBE frame generated by the client's connection. Depending
|
23
66
|
# upon the connection, a subscription can be set to various MESSAGE
|
24
67
|
# acknowledgement modes by setting the +:ack+ header.
|
@@ -50,29 +93,65 @@ module OnStomp::Interfaces::FrameMethods
|
|
50
93
|
# @see #unsubscribe
|
51
94
|
# @see #ack
|
52
95
|
# @see #nack
|
96
|
+
# @option headers [String] :id A unique ID for the subscription. If you
|
97
|
+
# do not set this header, an subscription ID will be automatically
|
98
|
+
# generated ensuring that all `onstomp` SUBSCRIBE frames have an ID.
|
99
|
+
# @option headers [String] :ack ('auto') The ack mode to use with this
|
100
|
+
# subscription. A value of 'auto' means MESSAGE frames are assumed
|
101
|
+
# received and no ACK frame is necessary. A value of 'client' or
|
102
|
+
# 'client-individual' means all MESSAGE frames should be acknowledged
|
103
|
+
# with an ACK (or un-acknowledged with a NACK.)
|
104
|
+
# @option headers [String] :selector A SQL style filter to use against
|
105
|
+
# MESSAGE frames (the form and availability of this will vary by
|
106
|
+
# broker.)
|
107
|
+
# @option headers [String] :receipt A receipt ID for the frame, this
|
108
|
+
# will be matched by the :'receipt-id' header in the broker's RECEIPT
|
109
|
+
# response.
|
110
|
+
# @example
|
111
|
+
# # A basic subscription
|
112
|
+
# client.subscribe '/queue/example' do |m|
|
113
|
+
# puts "Got a MESSAGE: #{m.body}"
|
114
|
+
# end
|
115
|
+
#
|
116
|
+
# # ACK our MESSAGE frames
|
117
|
+
# client.subscribe '/queue/example', :ack => 'client' do |m|
|
118
|
+
# client.ack m
|
119
|
+
# puts "Got (and ACK'd) a MESSAGE: #{m.body}"
|
120
|
+
# end
|
53
121
|
def subscribe dest, headers={}, &cb
|
54
122
|
transmit connection.subscribe_frame(dest, headers), :subscribe => cb
|
55
123
|
end
|
56
124
|
|
125
|
+
# @api gem:1 STOMP:1.0,1.1
|
57
126
|
# Transmits an UNSUBSCRIBE frame generated by the client's connection.
|
58
127
|
# @overload unsubscribe(subscribe_frame, headers={})
|
59
128
|
# Generates an UNSUBSCRIBE frame to match the given SUBSCRIBE frame
|
60
129
|
# @param [OnStomp::Components::Frame] subscribe_frame
|
61
130
|
# @param [{#to_sym => #to_s}] headers optional headers to include in
|
62
131
|
# the UNSUBSCRIBE frame
|
132
|
+
# @example
|
133
|
+
# sub = client.subscribe('/queue/test') { |m| ... }
|
134
|
+
# client.unsubscribe sub
|
63
135
|
# @overload unsubscribe(id, headers={})
|
64
136
|
# Generates an UNSUBSCRIBE frame with the given id
|
65
137
|
# @param [String] id
|
66
138
|
# @param [{#to_sym => #to_s}] headers optional headers to include in
|
67
139
|
# the UNSUBSCRIBE frame
|
140
|
+
# @example
|
141
|
+
# client.subscribe('/queue/test', :id => 's-1234') { |m| ... }
|
142
|
+
# client.unsubscribe 's-1234'
|
68
143
|
# @return [OnStomp::Components::Frame] UNSUBSCRIBE frame
|
69
144
|
# @raise OnStomp::UnsupportedCommandError if the connection does not support
|
70
145
|
# UNSUBSCRIBE frames
|
71
146
|
# @see #subscribe
|
147
|
+
# @option headers [String] :receipt A receipt ID for the frame, this
|
148
|
+
# will be matched by the :'receipt-id' header in the broker's RECEIPT
|
149
|
+
# response.
|
72
150
|
def unsubscribe frame_or_id, headers={}
|
73
151
|
transmit connection.unsubscribe_frame(frame_or_id, headers)
|
74
152
|
end
|
75
|
-
|
153
|
+
|
154
|
+
# @api gem:1 STOMP:1.0,1.1
|
76
155
|
# Transmits a BEGIN frame generated by the client's connection to start
|
77
156
|
# a transaction.
|
78
157
|
# @param [String] tx_id identifier for the transaction
|
@@ -83,10 +162,18 @@ module OnStomp::Interfaces::FrameMethods
|
|
83
162
|
# BEGIN frames
|
84
163
|
# @see #abort
|
85
164
|
# @see #commit
|
165
|
+
# @option headers [String] :receipt A receipt ID for the frame, this
|
166
|
+
# will be matched by the :'receipt-id' header in the broker's RECEIPT
|
167
|
+
# response.
|
168
|
+
# @example
|
169
|
+
# client.begin 't-1234'
|
170
|
+
# client.send '/queue/test', 'hello transaction!', :transaction => 't-1234'
|
171
|
+
# client.commit 't-1234'
|
86
172
|
def begin tx_id, headers={}
|
87
173
|
transmit connection.begin_frame(tx_id, headers)
|
88
174
|
end
|
89
|
-
|
175
|
+
|
176
|
+
# @api gem:1 STOMP:1.0,1.1
|
90
177
|
# Transmits an ABORT frame generated by the client's connection to rollback
|
91
178
|
# a transaction.
|
92
179
|
# @param [String] tx_id identifier for the transaction
|
@@ -97,10 +184,18 @@ module OnStomp::Interfaces::FrameMethods
|
|
97
184
|
# ABORT frames
|
98
185
|
# @see #begin
|
99
186
|
# @see #commit
|
187
|
+
# @option headers [String] :receipt A receipt ID for the frame, this
|
188
|
+
# will be matched by the :'receipt-id' header in the broker's RECEIPT
|
189
|
+
# response.
|
190
|
+
# @example
|
191
|
+
# client.begin 't-1234'
|
192
|
+
# client.send '/queue/test', 'hello transaction!', :transaction => 't-1234'
|
193
|
+
# client.abort 't-1234'
|
100
194
|
def abort tx_id, headers={}
|
101
195
|
transmit connection.abort_frame(tx_id, headers)
|
102
196
|
end
|
103
|
-
|
197
|
+
|
198
|
+
# @api gem:1 STOMP:1.0,1.1
|
104
199
|
# Transmits a COMMIT frame generated by the client's connection to complete
|
105
200
|
# a transaction.
|
106
201
|
# @param [String] tx_id identifier for the transaction
|
@@ -111,10 +206,18 @@ module OnStomp::Interfaces::FrameMethods
|
|
111
206
|
# COMMIT frames
|
112
207
|
# @see #abort
|
113
208
|
# @see #begin
|
209
|
+
# @option headers [String] :receipt A receipt ID for the frame, this
|
210
|
+
# will be matched by the :'receipt-id' header in the broker's RECEIPT
|
211
|
+
# response.
|
212
|
+
# @example
|
213
|
+
# client.begin 't-1234'
|
214
|
+
# client.send '/queue/test', 'hello transaction!', :transaction => 't-1234'
|
215
|
+
# client.commit 't-1234'
|
114
216
|
def commit tx_id, headers={}
|
115
217
|
transmit connection.commit_frame(tx_id, headers)
|
116
218
|
end
|
117
219
|
|
220
|
+
# @api gem:1 STOMP:1.0,1.1* [DISCONNECTs are now always RECEIPTable]
|
118
221
|
# Transmits a DISCONNECT frame generated by the client's connection to end
|
119
222
|
# the STOMP session.
|
120
223
|
# @param [{#to_sym => #to_s}] headers additional headers to include in
|
@@ -122,42 +225,77 @@ module OnStomp::Interfaces::FrameMethods
|
|
122
225
|
# @return [OnStomp::Components::Frame] DISCONNECT frame
|
123
226
|
# @raise OnStomp::UnsupportedCommandError if the connection does not support
|
124
227
|
# DISCONNECT frames
|
228
|
+
# @option headers [String] :receipt A receipt ID for the frame, this
|
229
|
+
# will be matched by the :'receipt-id' header in the broker's RECEIPT
|
230
|
+
# response.
|
231
|
+
# @example
|
232
|
+
# client.connect
|
233
|
+
# client.send '/queue/test', 'a quick message'
|
234
|
+
# client.disconnect
|
125
235
|
def disconnect headers={}
|
126
236
|
transmit connection.disconnect_frame headers
|
127
237
|
end
|
128
238
|
|
239
|
+
# @api gem:1 STOMP:1.0,1.1! [+subscription:id]
|
129
240
|
# Transmits an ACK frame generated by the client's connection.
|
130
241
|
# @overload ack(message_frame, headers={})
|
242
|
+
# @api gem:1 STOMP:1.0,1.1
|
131
243
|
# @note Users should use this form whenever possible as it will work
|
132
244
|
# with STOMP 1.0 and 1.1 connections.
|
133
245
|
# @param [OnStomp::Components::Frame] message_frame the MESSAGE frame to
|
134
246
|
# acknowledge.
|
135
247
|
# @param [{#to_sym => #to_s}] headers additional headers to include in
|
136
248
|
# the frame
|
249
|
+
# @example
|
250
|
+
# client.subscribe '/queue/test', :ack => 'client' do |m|
|
251
|
+
# if m[:'x-of-interest-to-me'] == 'hells yes'
|
252
|
+
# client.ack m
|
253
|
+
# end
|
254
|
+
# end
|
137
255
|
# @overload ack(message_id, headers={})
|
138
|
-
# @
|
256
|
+
# @api gem:1 STOMP:1.0
|
257
|
+
# @note This form will raise an `ArgumentError` with STOMP 1.1 connections
|
139
258
|
# as a subscription ID is also required to ACK a received MESSAGE.
|
140
259
|
# @param [String] message_id +message-id+ header of MESSAGE frame to
|
141
260
|
# acknowledge.
|
142
261
|
# @param [{#to_sym => #to_s}] headers additional headers to include in
|
143
262
|
# the frame
|
144
|
-
#
|
263
|
+
# @example
|
264
|
+
# client.subscribe '/queue/test', :ack => 'client' do |m|
|
265
|
+
# if m[:'x-of-interest-to-me'] == 'hells yes'
|
266
|
+
# client.ack m[:'message-id']
|
267
|
+
# end
|
268
|
+
# end
|
269
|
+
# @overload ack(message_id, subscription_id, headers={})
|
270
|
+
# @api gem:1 STOMP:1.0,1.1
|
145
271
|
# @note This form should be used with STOMP 1.1 connections when it is
|
146
272
|
# not possible to provide the actual MESSAGE frame.
|
147
273
|
# @param [String] message_id +message-id+ header of MESSAGE frame to
|
148
274
|
# acknowledge.
|
149
|
-
# @param [String] subscription_id
|
275
|
+
# @param [String] subscription_id `subscription` header of MESSAGE frame to
|
150
276
|
# acknowledge.
|
151
277
|
# @param [{#to_sym => #to_s}] headers additional headers to include in
|
152
278
|
# the frame
|
279
|
+
# @example
|
280
|
+
# client.subscribe '/queue/test', :ack => 'client' do |m|
|
281
|
+
# if m[:'x-of-interest-to-me'] == 'hells yes'
|
282
|
+
# client.ack m[:'message-id'], m[:subscription]
|
283
|
+
# end
|
284
|
+
# end
|
153
285
|
# @return [OnStomp::Components::Frame] ACK frame
|
154
286
|
# @raise OnStomp::UnsupportedCommandError if the connection does not support
|
155
287
|
# ACK frames
|
156
288
|
# @see #nack
|
289
|
+
# @option headers [String] :receipt A receipt ID for the frame, this
|
290
|
+
# will be matched by the :'receipt-id' header in the broker's RECEIPT
|
291
|
+
# response.
|
292
|
+
# @option headers [String] :transaction The ID of an existing transaction
|
293
|
+
# to add this frame to.
|
157
294
|
def ack *args
|
158
295
|
transmit connection.ack_frame(*args)
|
159
296
|
end
|
160
297
|
|
298
|
+
# @api gem:1 STOMP:1.1
|
161
299
|
# Transmits a NACK frame generated by the client's connection.
|
162
300
|
# @overload nack(message_frame, headers={})
|
163
301
|
# Generates a NACK frame for the given MESSAGE frame.
|
@@ -165,25 +303,48 @@ module OnStomp::Interfaces::FrameMethods
|
|
165
303
|
# un-acknowledge.
|
166
304
|
# @param [{#to_sym => #to_s}] headers additional headers to include in
|
167
305
|
# the frame
|
306
|
+
# @example
|
307
|
+
# client.subscribe '/queue/test', :ack => 'client' do |m|
|
308
|
+
# if m[:'x-of-interest-to-me'] == 'hells no!'
|
309
|
+
# client.nack m
|
310
|
+
# end
|
311
|
+
# end
|
168
312
|
# @overload nack(message_id, subscription_id, heders={})
|
169
313
|
# @param [String] message_id +message-id+ header of MESSAGE frame to
|
170
314
|
# un-acknowledge.
|
171
|
-
# @param [String] subscription_id
|
315
|
+
# @param [String] subscription_id `subscription` header of MESSAGE frame to
|
172
316
|
# un-acknowledge.
|
173
317
|
# @param [{#to_sym => #to_s}] headers additional headers to include in
|
174
318
|
# the frame
|
319
|
+
# @example
|
320
|
+
# client.subscribe '/queue/test', :ack => 'client' do |m|
|
321
|
+
# if m[:'x-of-interest-to-me'] == 'hells no!'
|
322
|
+
# client.nack m[:'message-id'], m[:subscription]
|
323
|
+
# end
|
324
|
+
# end
|
175
325
|
# @return [OnStomp::Components::Frame] NACK frame
|
176
326
|
# @raise OnStomp::UnsupportedCommandError if the connection does not support
|
177
327
|
# NACK frames
|
178
328
|
# @see #ack
|
329
|
+
# @option headers [String] :receipt A receipt ID for the frame, this
|
330
|
+
# will be matched by the :'receipt-id' header in the broker's RECEIPT
|
331
|
+
# response.
|
332
|
+
# @option headers [String] :transaction The ID of an existing transaction
|
333
|
+
# to add this frame to.
|
179
334
|
def nack *args
|
180
335
|
transmit connection.nack_frame(*args)
|
181
336
|
end
|
182
|
-
|
337
|
+
|
338
|
+
# @api gem:1 STOMP:1.1
|
183
339
|
# Transmits a client heartbeat frame generated by the client's connection.
|
184
340
|
# @return [OnStomp::Components::Frame] heartbeat frame
|
185
341
|
# @raise OnStomp::UnsupportedCommandError if the connection does not support
|
186
342
|
# heartbeat frames
|
343
|
+
# @example
|
344
|
+
# # If it's been a while since you've sent any data to the broker:
|
345
|
+
# client.beat
|
346
|
+
# # Now the broker knows you're still listening, nay hanging on its every
|
347
|
+
# # every word.
|
187
348
|
def beat
|
188
349
|
transmit connection.heartbeat_frame
|
189
350
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Module for configurable attributes
|
4
4
|
module OnStomp::Interfaces::UriConfigurable
|
5
|
-
# Extends
|
5
|
+
# Extends `base` with {OnStomp::Interfaces::UriConfigurable::ClassMethods}
|
6
6
|
def self.included(base)
|
7
7
|
base.extend ClassMethods
|
8
8
|
end
|
@@ -41,7 +41,7 @@ module OnStomp::Interfaces::UriConfigurable
|
|
41
41
|
# by a URI query parameter sharing the same name, a property of a URI or
|
42
42
|
# a default value. The value of this attribute will be transformed by
|
43
43
|
# invoking the given block, if one has been provided. If the attributes
|
44
|
-
# created by this method are assigned an
|
44
|
+
# created by this method are assigned an `Array`, only the first element
|
45
45
|
# will be used as their value.
|
46
46
|
def attr_configurable_single *args, &block
|
47
47
|
trans = attr_configurable_wrap lambda { |v| v.is_a?(Array) ? v.first : v }, block
|
@@ -63,7 +63,7 @@ module OnStomp::Interfaces::UriConfigurable
|
|
63
63
|
# by a URI query parameter sharing the same name, a property of a URI or
|
64
64
|
# a default value. The value of this attribute will be transformed by
|
65
65
|
# invoking the given block, if one has been provided. If the attributes
|
66
|
-
# created by this method are assigned a value that is not an
|
66
|
+
# created by this method are assigned a value that is not an `Array`, the
|
67
67
|
# value will be wrapped in an array.
|
68
68
|
def attr_configurable_arr *args, &block
|
69
69
|
trans = attr_configurable_wrap lambda { |v| Array(v) }, block
|
@@ -5,7 +5,7 @@
|
|
5
5
|
module OnStomp::OpenURI::ClientExtensions
|
6
6
|
attr_reader :auto_destination, :openuri_message_queue
|
7
7
|
|
8
|
-
# Aliases {#send_with_openuri} as
|
8
|
+
# Aliases {#send_with_openuri} as `send`
|
9
9
|
def self.extended inst
|
10
10
|
inst.instance_eval do
|
11
11
|
alias :send_without_openuri :send
|
@@ -43,8 +43,8 @@ module OnStomp::OpenURI::ClientExtensions
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
# Returns
|
47
|
-
# the next frame is returned, otherwise an array of the next
|
46
|
+
# Returns `n` frames read from the subscription. If `n` is ommited,
|
47
|
+
# the next frame is returned, otherwise an array of the next `n` frames
|
48
48
|
# is returned.
|
49
49
|
# @see #each
|
50
50
|
# @param [Fixnum,nil] n
|
@@ -62,7 +62,7 @@ module OnStomp::OpenURI::ClientExtensions
|
|
62
62
|
alias :gets :first
|
63
63
|
|
64
64
|
# Assigns the auto destination. When a stomp:// URI is opened, this
|
65
|
-
# will initially be set to the
|
65
|
+
# will initially be set to the `path` of the URI.
|
66
66
|
# @param [String] dest
|
67
67
|
# @return [String,nil]
|
68
68
|
def auto_destination= dest
|
data/lib/onstomp/version.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
-
# Primary namespace for the
|
3
|
+
# Primary namespace for the `onstomp` gem
|
4
4
|
module OnStomp
|
5
5
|
# Major / API version
|
6
6
|
MAJOR = 1
|
7
7
|
# Minor / feature version
|
8
8
|
MINOR = 0
|
9
9
|
# Patch version
|
10
|
-
PATCH =
|
10
|
+
PATCH = 1
|
11
11
|
# Complete version
|
12
12
|
VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
|
13
13
|
end
|