stomper 1.0.0 → 2.0.0
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 +5 -0
- data/{spec/spec.opts → .rspec} +0 -2
- data/Gemfile +4 -0
- data/LICENSE +201 -201
- data/README.md +130 -0
- data/Rakefile +5 -0
- data/examples/basic.rb +38 -0
- data/examples/events.rb +54 -0
- data/features/acking_messages.feature +147 -0
- data/features/disconnecting.feature +12 -0
- data/features/establish_connection.feature +44 -0
- data/features/protocol_version_negotiation.feature +61 -0
- data/features/receipts.feature +72 -0
- data/features/scopes.feature +32 -0
- data/features/secure_connections.feature +38 -0
- data/features/send_and_message.feature +28 -0
- data/features/steps/acking_messages_steps.rb +39 -0
- data/features/steps/disconnecting_steps.rb +8 -0
- data/features/steps/establish_connection_steps.rb +74 -0
- data/features/steps/frame_transmission_steps.rb +35 -0
- data/features/steps/protocol_version_negotiation_steps.rb +15 -0
- data/features/steps/receipts_steps.rb +79 -0
- data/features/steps/scopes_steps.rb +52 -0
- data/features/steps/secure_connections_steps.rb +41 -0
- data/features/steps/send_and_message_steps.rb +35 -0
- data/features/steps/subscribing_steps.rb +36 -0
- data/features/steps/threaded_receiver_steps.rb +8 -0
- data/features/steps/transactions_steps.rb +0 -0
- data/features/subscribing.feature +151 -0
- data/features/support/env.rb +11 -0
- data/features/support/header_helpers.rb +12 -0
- data/features/support/ssl/README +6 -0
- data/features/support/ssl/broker_cert.csr +17 -0
- data/features/support/ssl/broker_cert.pem +72 -0
- data/features/support/ssl/broker_key.pem +27 -0
- data/features/support/ssl/client_cert.csr +17 -0
- data/features/support/ssl/client_cert.pem +72 -0
- data/features/support/ssl/client_key.pem +27 -0
- data/features/support/ssl/demoCA/cacert.pem +17 -0
- data/features/support/ssl/demoCA/index.txt +2 -0
- data/features/support/ssl/demoCA/index.txt.attr +1 -0
- data/features/support/ssl/demoCA/index.txt.attr.old +1 -0
- data/features/support/ssl/demoCA/index.txt.old +1 -0
- data/features/support/ssl/demoCA/newcerts/01.pem +72 -0
- data/features/support/ssl/demoCA/newcerts/02.pem +72 -0
- data/features/support/ssl/demoCA/private/cakey.pem +17 -0
- data/features/support/ssl/demoCA/serial +1 -0
- data/features/support/ssl/demoCA/serial.old +1 -0
- data/features/support/test_stomp_server.rb +150 -0
- data/features/threaded_receiver.feature +11 -0
- data/features/transactions.feature +66 -0
- data/lib/stomper.rb +30 -20
- data/lib/stomper/connection.rb +442 -102
- data/lib/stomper/errors.rb +59 -0
- data/lib/stomper/extensions.rb +10 -0
- data/lib/stomper/extensions/common.rb +258 -0
- data/lib/stomper/extensions/events.rb +213 -0
- data/lib/stomper/extensions/heartbeat.rb +101 -0
- data/lib/stomper/extensions/scoping.rb +56 -0
- data/lib/stomper/frame.rb +54 -0
- data/lib/stomper/frame_serializer.rb +217 -0
- data/lib/stomper/headers.rb +15 -0
- data/lib/stomper/receipt_manager.rb +36 -0
- data/lib/stomper/receivers.rb +7 -0
- data/lib/stomper/receivers/threaded.rb +71 -0
- data/lib/stomper/scopes.rb +9 -0
- data/lib/stomper/scopes/header_scope.rb +49 -0
- data/lib/stomper/scopes/receipt_scope.rb +44 -0
- data/lib/stomper/scopes/transaction_scope.rb +109 -0
- data/lib/stomper/sockets.rb +66 -28
- data/lib/stomper/subscription_manager.rb +79 -0
- data/lib/stomper/support.rb +68 -0
- data/lib/stomper/support/1.8/frame_serializer.rb +53 -0
- data/lib/stomper/support/1.8/headers.rb +183 -0
- data/lib/stomper/support/1.9/frame_serializer.rb +64 -0
- data/lib/stomper/support/1.9/headers.rb +172 -0
- data/lib/stomper/support/ruby.rb +13 -0
- data/lib/stomper/uris.rb +49 -0
- data/lib/stomper/version.rb +7 -0
- data/spec/spec_helper.rb +13 -9
- data/spec/stomper/connection_spec.rb +712 -0
- data/spec/stomper/extensions/common_spec.rb +187 -0
- data/spec/stomper/extensions/events_spec.rb +78 -0
- data/spec/stomper/extensions/heartbeat_spec.rb +103 -0
- data/spec/stomper/extensions/scoping_spec.rb +21 -0
- data/spec/stomper/frame_serializer_1.8_spec.rb +318 -0
- data/spec/stomper/frame_serializer_spec.rb +316 -0
- data/spec/stomper/frame_spec.rb +36 -0
- data/spec/stomper/headers_spec.rb +224 -0
- data/spec/stomper/receipt_manager_spec.rb +91 -0
- data/spec/stomper/receivers/threaded_spec.rb +116 -0
- data/spec/stomper/scopes/header_scope_spec.rb +42 -0
- data/spec/stomper/scopes/receipt_scope_spec.rb +51 -0
- data/spec/stomper/scopes/transaction_scope_spec.rb +183 -0
- data/spec/stomper/sockets_spec.rb +113 -0
- data/spec/stomper/subscription_manager_spec.rb +107 -0
- data/spec/stomper/support_spec.rb +69 -0
- data/spec/stomper/uris_spec.rb +54 -0
- data/spec/stomper_spec.rb +9 -0
- data/spec/support/custom_argument_matchers.rb +57 -0
- data/spec/support/existential_frame_matchers.rb +19 -0
- data/spec/support/frame_header_matchers.rb +10 -0
- data/stomper.gemspec +30 -0
- metadata +272 -97
- data/AUTHORS +0 -21
- data/CHANGELOG +0 -20
- data/README.rdoc +0 -120
- data/lib/stomper/client.rb +0 -34
- data/lib/stomper/frame_reader.rb +0 -73
- data/lib/stomper/frame_writer.rb +0 -21
- data/lib/stomper/frames.rb +0 -39
- data/lib/stomper/frames/abort.rb +0 -10
- data/lib/stomper/frames/ack.rb +0 -25
- data/lib/stomper/frames/begin.rb +0 -11
- data/lib/stomper/frames/client_frame.rb +0 -89
- data/lib/stomper/frames/commit.rb +0 -10
- data/lib/stomper/frames/connect.rb +0 -10
- data/lib/stomper/frames/connected.rb +0 -30
- data/lib/stomper/frames/disconnect.rb +0 -10
- data/lib/stomper/frames/error.rb +0 -21
- data/lib/stomper/frames/message.rb +0 -48
- data/lib/stomper/frames/receipt.rb +0 -19
- data/lib/stomper/frames/send.rb +0 -10
- data/lib/stomper/frames/server_frame.rb +0 -38
- data/lib/stomper/frames/subscribe.rb +0 -42
- data/lib/stomper/frames/unsubscribe.rb +0 -19
- data/lib/stomper/open_uri_interface.rb +0 -41
- data/lib/stomper/receipt_handlers.rb +0 -23
- data/lib/stomper/receiptor.rb +0 -38
- data/lib/stomper/subscriber.rb +0 -76
- data/lib/stomper/subscription.rb +0 -128
- data/lib/stomper/subscriptions.rb +0 -95
- data/lib/stomper/threaded_receiver.rb +0 -59
- data/lib/stomper/transaction.rb +0 -185
- data/lib/stomper/transactor.rb +0 -50
- data/lib/stomper/uri.rb +0 -55
- data/spec/client_spec.rb +0 -29
- data/spec/connection_spec.rb +0 -22
- data/spec/frame_reader_spec.rb +0 -37
- data/spec/frame_writer_spec.rb +0 -27
- data/spec/frames/client_frame_spec.rb +0 -66
- data/spec/frames/indirect_frame_spec.rb +0 -45
- data/spec/frames/server_frame_spec.rb +0 -85
- data/spec/open_uri_interface_spec.rb +0 -132
- data/spec/receiptor_spec.rb +0 -35
- data/spec/shared_connection_examples.rb +0 -79
- data/spec/subscriber_spec.rb +0 -77
- data/spec/subscription_spec.rb +0 -157
- data/spec/subscriptions_spec.rb +0 -145
- data/spec/threaded_receiver_spec.rb +0 -33
- data/spec/transaction_spec.rb +0 -139
- data/spec/transactor_spec.rb +0 -46
data/Rakefile
ADDED
data/examples/basic.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.unshift(File.expand_path('../../lib', __FILE__))
|
3
|
+
require 'stomper'
|
4
|
+
|
5
|
+
$stdout.puts "Starting demo"
|
6
|
+
$stdout.puts "----------------------------"
|
7
|
+
|
8
|
+
client = Stomper::Connection.new("stomp://localhost")
|
9
|
+
client.start
|
10
|
+
|
11
|
+
$stdout.puts "Connected to broker using protocol #{client.version}"
|
12
|
+
|
13
|
+
client.subscribe("/queue/stomper/test") do |message|
|
14
|
+
$stdout.puts "Received: #{message.body}"
|
15
|
+
if message.body == 'finished'
|
16
|
+
client.stop
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
client.send("/queue/stomper/test", "hello world")
|
21
|
+
client.send("/queue/stomper/test", "this is a simple demo of stomper")
|
22
|
+
client.send("/queue/stomper/test", "finished")
|
23
|
+
|
24
|
+
Thread.pass while client.running?
|
25
|
+
$stdout.puts "----------------------------"
|
26
|
+
$stdout.puts "End of demo"
|
27
|
+
|
28
|
+
# Example output:
|
29
|
+
#
|
30
|
+
#
|
31
|
+
# Starting demo
|
32
|
+
# ----------------------------
|
33
|
+
# Connected to broker using protocol 1.0
|
34
|
+
# Received: hello world
|
35
|
+
# Received: this is a simple demo of stomper
|
36
|
+
# Received: finished
|
37
|
+
# ----------------------------
|
38
|
+
# End of demo
|
data/examples/events.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.unshift(File.expand_path('../../lib', __FILE__))
|
3
|
+
require 'stomper'
|
4
|
+
|
5
|
+
$stdout.puts "Starting demo"
|
6
|
+
$stdout.puts "----------------------------"
|
7
|
+
|
8
|
+
client = Stomper::Connection.open("stomp://localhost")
|
9
|
+
|
10
|
+
$stdout.puts "Connected to broker using protocol #{client.version}"
|
11
|
+
|
12
|
+
client.before_transmitting do |frame|
|
13
|
+
$stdout.puts "Frame headers [#{frame.command}] before modification: #{frame.headers.to_a.inspect}"
|
14
|
+
frame[:'x-alt-header'] = 'another value'
|
15
|
+
end
|
16
|
+
|
17
|
+
client.before_send do |frame|
|
18
|
+
$stdout.puts "SEND headers before modification: #{frame.headers.to_a.inspect}"
|
19
|
+
frame[:'x-misc-header'] = 'this is a test'
|
20
|
+
end
|
21
|
+
|
22
|
+
client.after_transmitting do |frame|
|
23
|
+
$stdout.puts "Final frame headers [#{frame.command}]: #{frame.headers.to_a.inspect}"
|
24
|
+
end
|
25
|
+
|
26
|
+
client.before_disconnect do |frame|
|
27
|
+
$stdout.puts "Disconnecting from broker"
|
28
|
+
end
|
29
|
+
|
30
|
+
client.on_connection_closed do |con|
|
31
|
+
$stdout.puts "Connection has been closed"
|
32
|
+
end
|
33
|
+
|
34
|
+
client.send("/queue/stomper/test", "hello world")
|
35
|
+
client.disconnect
|
36
|
+
|
37
|
+
$stdout.puts "----------------------------"
|
38
|
+
$stdout.puts "End of demo"
|
39
|
+
|
40
|
+
# Example output:
|
41
|
+
#
|
42
|
+
#
|
43
|
+
# Starting demo
|
44
|
+
# ----------------------------
|
45
|
+
# Connected to broker using protocol 1.0
|
46
|
+
# Frame headers [SEND] before modification: [["destination", "/queue/stomper/test"]]
|
47
|
+
# SEND headers before modification: [["destination", "/queue/stomper/test"], ["x-alt-header", "another value"]]
|
48
|
+
# Final frame headers [SEND]: [["destination", "/queue/stomper/test"], ["x-alt-header", "another value"], ["x-misc-header", "this is a test"]]
|
49
|
+
# Frame headers [DISCONNECT] before modification: []
|
50
|
+
# Disconnecting from broker
|
51
|
+
# Final frame headers [DISCONNECT]: [["x-alt-header", "another value"]]
|
52
|
+
# Connection has been closed
|
53
|
+
# ----------------------------
|
54
|
+
# End of demo
|
@@ -0,0 +1,147 @@
|
|
1
|
+
Feature: Acking messages
|
2
|
+
In order inform the broker that we have received and processed a MESSAGE
|
3
|
+
As a client
|
4
|
+
I want ensure ACK frames are properly sent
|
5
|
+
|
6
|
+
Scenario: Stomp 1.0 Acking a MESSAGE
|
7
|
+
Given a 1.0 connection between client and broker
|
8
|
+
And the broker sends a "MESSAGE" frame with headers
|
9
|
+
| header-name | header-value |
|
10
|
+
| message-id | m-1234 |
|
11
|
+
| subscription | s-5678 |
|
12
|
+
| destination | /queue/testing |
|
13
|
+
When the client acks the last MESSAGE
|
14
|
+
And the frame exchange is completed
|
15
|
+
Then the broker should have received an "ACK" frame with headers
|
16
|
+
| header-name | header-value |
|
17
|
+
| message-id | m-1234 |
|
18
|
+
|
19
|
+
Scenario: Stomp 1.0 Acking a MESSAGE by ID
|
20
|
+
Given a 1.0 connection between client and broker
|
21
|
+
And the broker sends a "MESSAGE" frame with headers
|
22
|
+
| header-name | header-value |
|
23
|
+
| message-id | m-1234 |
|
24
|
+
| subscription | s-5678 |
|
25
|
+
| destination | /queue/testing |
|
26
|
+
When the client acks a message by ID "m-1234"
|
27
|
+
And the frame exchange is completed
|
28
|
+
Then the broker should have received an "ACK" frame with headers
|
29
|
+
| header-name | header-value |
|
30
|
+
| message-id | m-1234 |
|
31
|
+
|
32
|
+
Scenario: Stomp 1.0 Nacking a MESSAGE
|
33
|
+
Given a 1.0 connection between client and broker
|
34
|
+
When the broker sends a "MESSAGE" frame with headers
|
35
|
+
| header-name | header-value |
|
36
|
+
| message-id | m-1234 |
|
37
|
+
| subscription | s-5678 |
|
38
|
+
| destination | /queue/testing |
|
39
|
+
Then the client nacking the last MESSAGE should raise an unsupported command error
|
40
|
+
|
41
|
+
|
42
|
+
Scenario: Stomp 1.1 Acking a MESSAGE
|
43
|
+
Given a 1.1 connection between client and broker
|
44
|
+
And the broker sends a "MESSAGE" frame with headers
|
45
|
+
| header-name | header-value |
|
46
|
+
| message-id | m-1234 |
|
47
|
+
| subscription | s-5678 |
|
48
|
+
| destination | /queue/testing |
|
49
|
+
When the client acks the last MESSAGE
|
50
|
+
And the frame exchange is completed
|
51
|
+
Then the broker should have received an "ACK" frame with headers
|
52
|
+
| header-name | header-value |
|
53
|
+
| message-id | m-1234 |
|
54
|
+
| subscription | s-5678 |
|
55
|
+
|
56
|
+
Scenario: Stomp 1.1 Acking a MESSAGE by ID and subscription
|
57
|
+
Given a 1.1 connection between client and broker
|
58
|
+
And the broker sends a "MESSAGE" frame with headers
|
59
|
+
| header-name | header-value |
|
60
|
+
| message-id | m-1234 |
|
61
|
+
| subscription | s-5678 |
|
62
|
+
| destination | /queue/testing |
|
63
|
+
When the client acks a message by ID "m-1234" and subscription "s-5678"
|
64
|
+
And the frame exchange is completed
|
65
|
+
Then the broker should have received an "ACK" frame with headers
|
66
|
+
| header-name | header-value |
|
67
|
+
| message-id | m-1234 |
|
68
|
+
| subscription | s-5678 |
|
69
|
+
|
70
|
+
Scenario: Stomp 1.1 Nacking a MESSAGE
|
71
|
+
Given a 1.1 connection between client and broker
|
72
|
+
And the broker sends a "MESSAGE" frame with headers
|
73
|
+
| header-name | header-value |
|
74
|
+
| message-id | m-1234 |
|
75
|
+
| subscription | s-5678 |
|
76
|
+
| destination | /queue/testing |
|
77
|
+
When the client nacks the last MESSAGE
|
78
|
+
And the frame exchange is completed
|
79
|
+
Then the broker should have received a "NACK" frame with headers
|
80
|
+
| header-name | header-value |
|
81
|
+
| message-id | m-1234 |
|
82
|
+
| subscription | s-5678 |
|
83
|
+
|
84
|
+
Scenario: Stomp 1.1 Nacking a MESSAGE by ID and subscription
|
85
|
+
Given a 1.1 connection between client and broker
|
86
|
+
And the broker sends a "MESSAGE" frame with headers
|
87
|
+
| header-name | header-value |
|
88
|
+
| message-id | m-1234 |
|
89
|
+
| subscription | s-5678 |
|
90
|
+
| destination | /queue/testing |
|
91
|
+
When the client nacks a message by ID "m-1234" and subscription "s-5678"
|
92
|
+
And the frame exchange is completed
|
93
|
+
Then the broker should have received an "NACK" frame with headers
|
94
|
+
| header-name | header-value |
|
95
|
+
| message-id | m-1234 |
|
96
|
+
| subscription | s-5678 |
|
97
|
+
|
98
|
+
Scenario: Stomp 1.1 Acking a MESAGE by ID should raise an error
|
99
|
+
Given a 1.1 connection between client and broker
|
100
|
+
When the broker sends a "MESSAGE" frame with headers
|
101
|
+
| header-name | header-value |
|
102
|
+
| message-id | m-1234 |
|
103
|
+
| subscription | s-5678 |
|
104
|
+
| destination | /queue/testing |
|
105
|
+
Then the client acking a message by ID "m-1234" should raise an argument error
|
106
|
+
|
107
|
+
Scenario: Stomp 1.1 Nacking a MESAGE by ID should raise an error
|
108
|
+
Given a 1.1 connection between client and broker
|
109
|
+
When the broker sends a "MESSAGE" frame with headers
|
110
|
+
| header-name | header-value |
|
111
|
+
| message-id | m-1234 |
|
112
|
+
| subscription | s-5678 |
|
113
|
+
| destination | /queue/testing |
|
114
|
+
Then the client nacking a message by ID "m-1234" should raise an argument error
|
115
|
+
|
116
|
+
Scenario: Stomp 1.1 Acking a MESAGE without a subscription should raise an error
|
117
|
+
Given a 1.1 connection between client and broker
|
118
|
+
When the broker sends a "MESSAGE" frame with headers
|
119
|
+
| header-name | header-value |
|
120
|
+
| message-id | m-1234 |
|
121
|
+
| destination | /queue/testing |
|
122
|
+
Then the client acking the last MESSAGE should raise an argument error
|
123
|
+
|
124
|
+
Scenario: Stomp 1.1 Nacking a MESAGE without a subscription should raise an error
|
125
|
+
Given a 1.1 connection between client and broker
|
126
|
+
When the broker sends a "MESSAGE" frame with headers
|
127
|
+
| header-name | header-value |
|
128
|
+
| message-id | m-1234 |
|
129
|
+
| destination | /queue/testing |
|
130
|
+
Then the client nacking the last MESSAGE should raise an argument error
|
131
|
+
|
132
|
+
Scenario: Stomp 1.1 Acking a MESAGE without a message-id should raise an error
|
133
|
+
Given a 1.1 connection between client and broker
|
134
|
+
When the broker sends a "MESSAGE" frame with headers
|
135
|
+
| header-name | header-value |
|
136
|
+
| subscription | s-5678 |
|
137
|
+
| destination | /queue/testing |
|
138
|
+
Then the client acking the last MESSAGE should raise an argument error
|
139
|
+
|
140
|
+
Scenario: Stomp 1.1 Nacking a MESAGE without a message-id should raise an error
|
141
|
+
Given a 1.1 connection between client and broker
|
142
|
+
When the broker sends a "MESSAGE" frame with headers
|
143
|
+
| header-name | header-value |
|
144
|
+
| subscription | s-5678 |
|
145
|
+
| destination | /queue/testing |
|
146
|
+
Then the client nacking the last MESSAGE should raise an argument error
|
147
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Disconnecting
|
2
|
+
In order to shut down a connection
|
3
|
+
As a client
|
4
|
+
I want to be able to disconnect
|
5
|
+
|
6
|
+
|
7
|
+
Scenario: A standard disconnect
|
8
|
+
Given a Stomp broker
|
9
|
+
And an established connection
|
10
|
+
When the client disconnects
|
11
|
+
Then the client should not be connected
|
12
|
+
And the broker should have received a "DISCONNECT" frame
|
@@ -0,0 +1,44 @@
|
|
1
|
+
Feature: Establish connection
|
2
|
+
In order to actually do something useful with a Stomp broker
|
3
|
+
As a client
|
4
|
+
I want to be able to connect
|
5
|
+
|
6
|
+
Scenario: Connecting to a Stomp 1.0 Broker
|
7
|
+
Given a Stomp 1.0 broker
|
8
|
+
When a connection is created from the broker's URI
|
9
|
+
And the connection is told to connect
|
10
|
+
Then the connection should be connected
|
11
|
+
And the connection should be using the 1.0 protocol
|
12
|
+
|
13
|
+
Scenario: Connecting to a Stomp 1.0 Broker by string
|
14
|
+
Given a Stomp 1.0 broker
|
15
|
+
When a connection is created from the broker's URI string
|
16
|
+
And the connection is told to connect
|
17
|
+
Then the connection should be connected
|
18
|
+
And the connection should be using the 1.0 protocol
|
19
|
+
|
20
|
+
Scenario: Connecting to a Stomp 1.1 Broker
|
21
|
+
Given a Stomp 1.1 broker
|
22
|
+
When a connection is created from the broker's URI
|
23
|
+
And the connection is told to connect
|
24
|
+
Then the connection should be connected
|
25
|
+
And the connection should be using the 1.1 protocol
|
26
|
+
|
27
|
+
Scenario: Connecting to a Stomp 1.1 Broker by string
|
28
|
+
Given a Stomp 1.1 broker
|
29
|
+
When a connection is created from the broker's URI string
|
30
|
+
And the connection is told to connect
|
31
|
+
Then the connection should be connected
|
32
|
+
And the connection should be using the 1.1 protocol
|
33
|
+
|
34
|
+
Scenario: Connecting to a Broker using an unsupported version
|
35
|
+
Given a Stomp 3.2 broker
|
36
|
+
When a connection is created from the broker's URI
|
37
|
+
Then connecting should raise an unsupported protocol version error
|
38
|
+
And the connection should not be connected
|
39
|
+
|
40
|
+
Scenario: Connecting to a Broker whose first frame is not CONNECTED
|
41
|
+
Given an erroring Stomp broker
|
42
|
+
When a connection is created from the broker's URI
|
43
|
+
Then connecting should raise an connect failed error
|
44
|
+
And the connection should not be connected
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Feature: Protocol version negotiation
|
2
|
+
In order to handle connecting to different Stomp protocol implementations
|
3
|
+
As a client
|
4
|
+
I want to be able to negotiate the Stomp protocol to use
|
5
|
+
|
6
|
+
Scenario: By default, allow 1.1 from broker
|
7
|
+
Given a Stomp 1.1 broker
|
8
|
+
When a connection is established
|
9
|
+
Then the connection should be using the 1.1 protocol
|
10
|
+
|
11
|
+
Scenario: By default, allow 1.0 from broker
|
12
|
+
Given a Stomp 1.0 broker
|
13
|
+
When a connection is established
|
14
|
+
Then the connection should be using the 1.0 protocol
|
15
|
+
|
16
|
+
Scenario: By default, assume 1.0 from version-less broker
|
17
|
+
Given an unversioned Stomp broker
|
18
|
+
When a connection is established
|
19
|
+
Then the connection should be using the 1.0 protocol
|
20
|
+
|
21
|
+
Scenario: By default, raise error if the broker's version isn't supported
|
22
|
+
Given a Stomp 2.1 broker
|
23
|
+
When a connection is created from the broker's URI
|
24
|
+
Then connecting should raise an unsupported protocol version error
|
25
|
+
|
26
|
+
Scenario: A 1.0 client should accept a 1.0 broker
|
27
|
+
Given a Stomp 1.0 broker
|
28
|
+
When the client protocol version is "1.0"
|
29
|
+
And a connection is established
|
30
|
+
Then the connection should be using the 1.0 protocol
|
31
|
+
|
32
|
+
Scenario: A 1.0 client should accept a version-less broker
|
33
|
+
Given an unversioned Stomp broker
|
34
|
+
When the client protocol version is "1.0"
|
35
|
+
And a connection is established
|
36
|
+
Then the connection should be using the 1.0 protocol
|
37
|
+
|
38
|
+
Scenario: A 1.0 client should not accept a 1.1 broker
|
39
|
+
Given a Stomp 1.1 broker
|
40
|
+
When the client protocol version is "1.0"
|
41
|
+
And a connection is created from the broker's URI
|
42
|
+
Then connecting should raise an unsupported protocol version error
|
43
|
+
|
44
|
+
Scenario: A 1.1 client should accept a 1.1 broker
|
45
|
+
Given a Stomp 1.1 broker
|
46
|
+
When the client protocol version is "1.1"
|
47
|
+
And a connection is established
|
48
|
+
Then the connection should be using the 1.1 protocol
|
49
|
+
|
50
|
+
Scenario: A 1.1 client should not accept a 1.0 broker
|
51
|
+
Given a Stomp 1.0 broker
|
52
|
+
When the client protocol version is "1.1"
|
53
|
+
And a connection is created from the broker's URI
|
54
|
+
Then connecting should raise an unsupported protocol version error
|
55
|
+
|
56
|
+
Scenario: A 1.1 client should not accept a version-less broker
|
57
|
+
Given an unversioned Stomp broker
|
58
|
+
When the client protocol version is "1.1"
|
59
|
+
And a connection is created from the broker's URI
|
60
|
+
Then connecting should raise an unsupported protocol version error
|
61
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
Feature: Receipts
|
2
|
+
In order to ensure frame delivery
|
3
|
+
As a client
|
4
|
+
I want to request and monitor RECEIPT frames
|
5
|
+
|
6
|
+
Scenario: RECEIPT on SEND
|
7
|
+
Given a 1.1 connection between client and broker
|
8
|
+
When the client sends a receipted message "test message" to "/queue/test"
|
9
|
+
And the frame exchange is completed
|
10
|
+
Then the client should have received a receipt for the last "SEND"
|
11
|
+
|
12
|
+
Scenario: RECEIPT on SUBSCRIBE
|
13
|
+
Given a 1.1 connection between client and broker
|
14
|
+
When the client subscribes to "/queue/test" with a receipt
|
15
|
+
And the frame exchange is completed
|
16
|
+
Then the client should have received a receipt for the last "SUBSCRIBE"
|
17
|
+
|
18
|
+
Scenario: RECEIPT on UNSUBSCRIBE
|
19
|
+
Given a 1.1 connection between client and broker
|
20
|
+
And the client subscribes to "/queue/testing" with headers
|
21
|
+
| header-name | header-value |
|
22
|
+
| id | s-1234 |
|
23
|
+
When the client unsubscribes from "s-1234" with a receipt
|
24
|
+
And the frame exchange is completed
|
25
|
+
Then the client should have received a receipt for the last "UNSUBSCRIBE"
|
26
|
+
|
27
|
+
Scenario: RECEIPT on BEGIN
|
28
|
+
Given a 1.1 connection between client and broker
|
29
|
+
When the client begins transaction "t-1234" with a receipt
|
30
|
+
And the frame exchange is completed
|
31
|
+
Then the client should have received a receipt for the last "BEGIN"
|
32
|
+
|
33
|
+
Scenario: RECEIPT on COMMIT
|
34
|
+
Given a 1.1 connection between client and broker
|
35
|
+
When the client commits transaction "t-1234" with a receipt
|
36
|
+
And the frame exchange is completed
|
37
|
+
Then the client should have received a receipt for the last "COMMIT"
|
38
|
+
|
39
|
+
Scenario: RECEIPT on ABORT
|
40
|
+
Given a 1.1 connection between client and broker
|
41
|
+
When the client aborts transaction "t-1234" with a receipt
|
42
|
+
And the frame exchange is completed
|
43
|
+
Then the client should have received a receipt for the last "ABORT"
|
44
|
+
|
45
|
+
Scenario: RECEIPT on ACK
|
46
|
+
Given a 1.1 connection between client and broker
|
47
|
+
When the client acks message "m-1234" from "s-5678" with a receipt
|
48
|
+
And the frame exchange is completed
|
49
|
+
Then the client should have received a receipt for the last "ACK"
|
50
|
+
|
51
|
+
Scenario: RECEIPT on NACK
|
52
|
+
Given a 1.1 connection between client and broker
|
53
|
+
When the client nacks message "m-1234" from "s-5678" with a receipt
|
54
|
+
And the frame exchange is completed
|
55
|
+
Then the client should have received a receipt for the last "NACK"
|
56
|
+
|
57
|
+
Scenario: RECEIPT on DISCONNECT
|
58
|
+
Given a 1.1 connection between client and broker
|
59
|
+
When the client disconnects with a receipt
|
60
|
+
And the frame exchange is completed without client disconnect
|
61
|
+
Then the client should have received a receipt for the last "DISCONNECT"
|
62
|
+
|
63
|
+
Scenario: No RECEIPT header on CONNECT
|
64
|
+
Given a 1.1 connection between client and broker
|
65
|
+
When the client connects with a receipt
|
66
|
+
And the frame exchange is completed
|
67
|
+
Then the client should not have added a receipt header to the last "CONNECT"
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Feature: Scopes
|
2
|
+
In order to apply similar behavior to a series of frames
|
3
|
+
As a client
|
4
|
+
I want to have frame scopes
|
5
|
+
|
6
|
+
Scenario: Applying a set of headers to a series of frames
|
7
|
+
Given a 1.1 connection between client and broker
|
8
|
+
And a header scope with headers
|
9
|
+
| header-name | header-value |
|
10
|
+
| x-my-header | some value |
|
11
|
+
| canon:unisono | violini |
|
12
|
+
| x-machine | a\b\c |
|
13
|
+
When the client acks a message by ID "m-1234" and subscription "s-5678" within the scope
|
14
|
+
And the client subscribes to "/topic/test" with headers within the scope
|
15
|
+
| header-name | header-value |
|
16
|
+
| id | s-9012 |
|
17
|
+
| ack | client-individual |
|
18
|
+
Then the broker should have received an "ACK" frame with headers
|
19
|
+
| header-name | header-value |
|
20
|
+
| x-my-header | some value |
|
21
|
+
| canon:unisono | violini |
|
22
|
+
| x-machine | a\b\c |
|
23
|
+
| message-id | m-1234 |
|
24
|
+
| subscription | s-5678 |
|
25
|
+
And the broker should have received a "SUBSCRIBE" frame with headers
|
26
|
+
| header-name | header-value |
|
27
|
+
| x-my-header | some value |
|
28
|
+
| canon:unisono | violini |
|
29
|
+
| x-machine | a\b\c |
|
30
|
+
| id | s-9012 |
|
31
|
+
| destination | /topic/test |
|
32
|
+
| ack | client-individual |
|