2020-05-25 21:55:51 +08:00
= RabbitMQ Stream Protocol Reference
2020-06-09 19:53:49 +08:00
This is the reference of the RabbitMQ stream protocol. Note the protocol
is still under development and is subject to change.
2021-01-18 21:25:24 +08:00
The https://github.com/rabbitmq/rabbitmq-stream-java-client[RabbitMQ Stream Java client]
2020-06-09 19:53:49 +08:00
is currently the reference implementation.
2020-05-25 21:55:51 +08:00
== Types
int8, int16, int32, int64 - Signed integers (big endian order)
2020-09-29 17:29:56 +08:00
uint8, uint16, uint32, uint64 - Unsigned integers (big endian order)
2020-05-25 21:55:51 +08:00
bytes - int32 for the length followed by the bytes of content, length of -1 indicates null.
string - int16 for the length followed by the bytes of content, length of -1 indicates null.
arrays - int32 for the length followed by the repetition of the structure, notation uses [], e.g.
[int32] for an array of int32.
== Frame Structure
```
Frame => Size (Request | Response | Command)
2021-02-26 18:59:16 +08:00
Size => uint32 (size without the 4 bytes of the size element)
2020-05-25 21:55:51 +08:00
Request => Key Version (CorrelationId) Content
2021-02-26 18:59:16 +08:00
Key => uint16
Version => uint16
CorrelationId => uint32
2020-05-25 21:55:51 +08:00
Command => bytes // see command details below
Response => Key Version CorrelationId ResponseCode
2021-02-26 18:59:16 +08:00
Key => uint16
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2020-05-25 21:55:51 +08:00
Command => Key Version Content
2021-02-26 18:59:16 +08:00
Key => uint16
Version => uint16
2020-05-25 21:55:51 +08:00
Content => bytes // see command details below
```
Most commands are request/reply, but some commands (e.g. `Deliver`) are one-direction only and thus
2021-02-22 18:42:34 +08:00
does not contain a correlation ID.
Some responses may carry additional information than just the response code, this is specified in the command definition.
2020-05-25 21:55:51 +08:00
2021-02-26 18:59:16 +08:00
Keys are uint16, but the actual value is defined on the last 15 bits, the most significant bit being
2021-02-26 18:03:36 +08:00
used to make the difference between a request (0) and a response (1). Example for `subscribe`
(key is 6):
```
0b00000000 00000110 => subscribe request
0b10000000 00000110 => subscribe response
```
2021-01-18 21:25:24 +08:00
== Response Codes
.Stream Protocol Response Codes
|===
|Response|Code
2021-02-26 18:48:45 +08:00
|OK|1
|Stream does not exist|2
|Subscription ID already exists|3
|Subscription ID does not exist|4
|Stream already exists|5
|Stream not available|6
|SASL mechanism not supported|7
|Authentication failure|8
|SASL error|9
|SASL challenge|10
|SASL authentication failure loopback|11
|Virtual host access failure|12
|Unknown frame|13
|Frame too large|14
|Internal error|15
|Access refused|16
|Precondition failed|17
|Publisher does not exist|18
2021-01-18 21:25:24 +08:00
|===
2020-05-25 21:55:51 +08:00
== Commands
.Stream Protocol Commands
|===
|Command |From |Key | Expects response?
2021-02-22 22:19:58 +08:00
|<<declarepublisher>>
2020-05-25 21:55:51 +08:00
|Client
2021-02-26 18:48:45 +08:00
|1
2021-01-18 18:25:21 +08:00
|Yes
2020-05-25 21:55:51 +08:00
2021-01-18 18:25:21 +08:00
|<<publish>>
|Client
2021-02-26 18:48:45 +08:00
|2
2020-05-25 21:55:51 +08:00
|No
2020-05-25 23:02:43 +08:00
2021-01-18 18:25:21 +08:00
|<<publishconfirm>>
|Server
2021-02-26 18:48:45 +08:00
|3
2021-01-18 18:25:21 +08:00
|No
2020-05-25 23:02:43 +08:00
2021-01-18 18:25:21 +08:00
|<<publisherror>>
2020-05-25 23:02:43 +08:00
|Server
2021-02-26 18:48:45 +08:00
|4
2020-05-25 23:02:43 +08:00
|No
2021-01-18 18:25:21 +08:00
|<<querypublishersequence>>
2020-05-25 23:02:43 +08:00
|Client
2021-02-26 18:48:45 +08:00
|5
2021-01-18 18:25:21 +08:00
|Yes
2020-05-25 23:02:43 +08:00
2021-02-22 22:19:58 +08:00
|<<deletepublisher>>
2020-05-25 23:02:43 +08:00
|Client
2021-02-26 18:48:45 +08:00
|6
2020-05-25 23:02:43 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<subscribe>>
|Client
2021-02-26 18:48:45 +08:00
|7
2021-01-18 18:25:21 +08:00
|Yes
2020-05-25 23:02:43 +08:00
2021-01-18 18:25:21 +08:00
|<<deliver>>
2020-05-25 23:02:43 +08:00
|Server
2021-02-26 18:48:45 +08:00
|8
2020-05-25 23:02:43 +08:00
|No
2021-01-18 18:25:21 +08:00
|<<credit>>
2020-05-25 23:02:43 +08:00
|Client
2021-02-26 18:48:45 +08:00
|9
2020-05-25 23:02:43 +08:00
|No
2021-07-08 16:32:04 +08:00
|<<storeoffset>>
2020-05-25 23:02:43 +08:00
|Client
2021-02-26 18:48:45 +08:00
|10
2021-01-18 18:25:21 +08:00
|No
2020-05-25 23:02:43 +08:00
2021-01-18 18:25:21 +08:00
|<<queryoffset>>
2020-05-25 23:02:43 +08:00
|Client
2021-02-26 18:48:45 +08:00
|11
2020-05-25 23:02:43 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<unsubscribe>>
|Client
2021-02-26 18:48:45 +08:00
|12
2020-05-25 23:02:43 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<create>>
|Client
2021-02-26 18:48:45 +08:00
|13
2020-05-25 23:02:43 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<delete>>
|Client
2021-02-26 18:48:45 +08:00
|14
2020-05-25 23:02:43 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<metadata>>
|Client
2021-02-26 18:48:45 +08:00
|15
2021-02-22 22:19:58 +08:00
|Yes
2020-05-25 23:02:43 +08:00
2021-01-18 18:25:21 +08:00
|<<metadataupdate>>
|Server
2021-02-26 18:48:45 +08:00
|16
2021-01-18 18:25:21 +08:00
|No
2020-06-10 16:42:29 +08:00
2021-01-18 18:25:21 +08:00
|<<peerproperties>>
2020-09-15 23:52:05 +08:00
|Client
2021-02-26 18:48:45 +08:00
|17
2021-01-18 18:25:21 +08:00
|Yes
2020-09-15 23:52:05 +08:00
2021-01-18 18:25:21 +08:00
|<<saslhandshake>>
2020-09-15 23:52:05 +08:00
|Client
2021-02-26 18:48:45 +08:00
|18
2020-09-15 23:52:05 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<saslauthenticate>>
2020-11-20 18:43:04 +08:00
|Client
2021-02-26 18:48:45 +08:00
|19
2020-11-20 18:43:04 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<tune>>
|Server
2021-02-26 18:48:45 +08:00
|20
2020-11-20 18:43:04 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<open>>
2021-05-19 18:34:35 +08:00
|Client
2021-02-26 18:48:45 +08:00
|21
2020-11-26 17:02:13 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<close>>
|Client & Server
2021-02-26 18:48:45 +08:00
|22
2020-05-25 23:02:43 +08:00
|Yes
2021-01-18 18:25:21 +08:00
|<<heartbeat>>
|Client & Server
2021-02-26 18:48:45 +08:00
|23
2021-01-18 18:25:21 +08:00
|No
2021-02-26 00:22:42 +08:00
|<<route>> (experimental)
|Client
2021-02-26 18:48:45 +08:00
|24
2021-02-26 00:22:42 +08:00
|Yes
|<<partitions>> (experimental)
|Client
2021-02-26 18:48:45 +08:00
|25
2021-02-26 00:22:42 +08:00
|Yes
2020-05-25 21:55:51 +08:00
|===
2021-01-18 18:25:21 +08:00
=== DeclarePublisher
```
DeclarePublisherRequest => Key Version CorrelationId PublisherId [PublisherReference] Stream
2021-02-26 18:59:16 +08:00
Key => uint16 // 1
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
PublisherId => uint8
PublisherReference => string // max 256 characters
Stream => string
DeclarePublisherResponse => Key Version CorrelationId ResponseCode PublisherId
2021-02-26 18:59:16 +08:00
Key => uint16 // 1
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2021-01-18 18:25:21 +08:00
```
2020-05-25 21:55:51 +08:00
=== Publish
```
2020-05-25 23:02:43 +08:00
Publish => Key Version Stream PublishedMessages
2021-02-26 18:59:16 +08:00
Key => uint16 // 2
Version => uint16
2020-09-29 17:29:56 +08:00
PublisherId => uint8
2020-05-25 21:55:51 +08:00
PublishedMessages => [PublishedMessage]
PublishedMessage => PublishingId Message
2021-02-26 18:59:16 +08:00
PublishingId => uint64
2020-05-25 21:55:51 +08:00
Message => bytes
```
=== PublishConfirm
```
PublishConfirm => Key Version PublishingIds
2021-02-26 18:59:16 +08:00
Key => uint16 // 3
Version => uint16
2020-09-29 17:29:56 +08:00
PublisherId => uint8
2021-02-26 18:59:16 +08:00
PublishingIds => [uint64] // to correlate with the messages sent
2020-05-25 21:55:51 +08:00
```
2020-05-25 23:02:43 +08:00
2021-01-18 18:25:21 +08:00
=== PublishError
```
PublishError => Key Version [PublishingError]
2021-02-26 18:59:16 +08:00
Key => uint16 // 4
Version => uint16
2021-01-18 18:25:21 +08:00
PublisherId => uint8
PublishingError => PublishingId Code
2021-02-26 18:59:16 +08:00
PublishingId => uint64
Code => uint16 // code to identify the problem
2021-01-18 18:25:21 +08:00
```
=== QueryPublisherSequence
```
QueryPublisherRequest => Key Version CorrelationId PublisherReference Stream
2021-02-26 18:59:16 +08:00
Key => uint16 // 5
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
PublisherReference => string // max 256 characters
Stream => string
QueryPublisherResponse => Key Version CorrelationId ResponseCode Sequence
2021-02-26 18:59:16 +08:00
Key => uint16 // 5
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2021-01-18 18:25:21 +08:00
Sequence => uint64
```
=== DeletePublisher
```
DeletePublisherRequest => Key Version CorrelationId PublisherId
2021-02-26 18:59:16 +08:00
Key => uint16 // 6
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
PublisherId => uint8
DeletePublisherResponse => Key Version CorrelationId ResponseCode
2021-02-26 18:59:16 +08:00
Key => uint16 // 6
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2021-01-18 18:25:21 +08:00
```
2020-05-25 23:02:43 +08:00
=== Subscribe
```
2021-05-19 18:26:30 +08:00
Subscribe => Key Version CorrelationId SubscriptionId Stream OffsetSpecification Credit Properties
2021-02-26 18:59:16 +08:00
Key => uint16 // 7
Version => uint16
CorrelationId => uint32 // correlation id to correlate the response
2020-09-29 17:29:56 +08:00
SubscriptionId => uint8 // client-supplied id to identify the subscription
2020-05-25 23:02:43 +08:00
Stream => string // the name of the stream
2020-06-02 22:35:00 +08:00
OffsetSpecification => OffsetType Offset
2021-02-26 18:59:16 +08:00
OffsetType => uint16 // 1 (first), 2 (last), 3 (next), 4 (offset), 5 (timestamp)
2020-06-02 22:35:00 +08:00
Offset => uint64 (for offset) | int64 (for timestamp)
2021-02-26 18:59:16 +08:00
Credit => uint16
2021-05-19 18:26:30 +08:00
Properties => [Property]
Property => Key Value
Key => string
Value => string
2020-05-25 23:02:43 +08:00
```
=== Deliver
```
Deliver => Key Version SubscriptionId OsirisChunk
2021-02-26 18:59:16 +08:00
Key => uint16 // 8
Version => uint32
2020-09-29 17:29:56 +08:00
SubscriptionId => uint8
2020-05-25 23:02:43 +08:00
OsirisChunk => MagicVersion NumEntries NumRecords Epoch ChunkFirstOffset ChunkCrc DataLength Messages
MagicVersion => int8
NumEntries => uint16
NumRecords => uint32
Epoch => uint64
ChunkFirstOffset => uint64
ChunkCrc => int32
DataLength => uint32
Messages => [Message] // no int32 for the size for this array
Message => EntryTypeAndSize
Data => bytes
```
2020-06-02 17:13:19 +08:00
NB: See the https://github.com/rabbitmq/osiris/blob/348db0528986d6025b823bcf1ae0570aa63f5e25/src/osiris_log.erl#L49-L81[Osiris project]
2020-05-25 23:02:43 +08:00
for details on the structure of messages.
=== Credit
```
Credit => Key Version SubscriptionId Credit
2021-02-26 18:59:16 +08:00
Key => uint16 // 9
Version => uint16
SubscriptionId => uint8
Credit => uint16 // the number of chunks that can be sent
2020-06-19 21:27:46 +08:00
CreditResponse => Key Version ResponseCode SubscriptionId
2021-02-26 18:59:16 +08:00
Key => uint16 // 9
Version => uint16
ResponseCode => uint16
SubscriptionId => uint8
2020-05-25 23:02:43 +08:00
```
2020-06-19 21:27:46 +08:00
NB: the server sent a response only in case of problem, e.g. crediting an unknown subscription.
2021-07-08 16:32:04 +08:00
=== StoreOffset
2020-05-25 23:02:43 +08:00
```
2021-07-08 16:32:04 +08:00
StoreOffset => Key Version Reference Stream Offset
2021-02-26 18:59:16 +08:00
Key => uint16 // 10
Version => uint16
2021-01-18 18:25:21 +08:00
Reference => string // max 256 characters
SubscriptionId => uint8
2021-02-26 18:59:16 +08:00
Offset => uint64
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
=== QueryOffset
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
QueryOffsetRequest => Key Version CorrelationId Reference Stream
2021-02-26 18:59:16 +08:00
Key => uint16 // 11
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
Reference => string // max 256 characters
Stream => string
2020-05-25 23:02:43 +08:00
2021-01-18 18:25:21 +08:00
QueryOffsetResponse => Key Version CorrelationId ResponseCode Offset
2021-02-26 18:59:16 +08:00
Key => uint16 // 11
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2021-01-18 18:25:21 +08:00
Offset => uint64
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
=== Unsubscribe
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
Unsubscribe => Key Version CorrelationId SubscriptionId
2021-02-26 18:59:16 +08:00
Key => uint16 // 12
Version => uint16
CorrelationId => uint32
SubscriptionId => uint8
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
=== Create
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
Create => Key Version CorrelationId Stream Arguments
2021-02-26 18:59:16 +08:00
Key => uint16 // 13
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
Stream => string
Arguments => [Argument]
Argument => Key Value
Key => string
Value => string
```
2020-05-25 23:02:43 +08:00
2021-01-18 18:25:21 +08:00
=== Delete
```
Delete => Key Version CorrelationId Stream
2021-02-26 18:59:16 +08:00
Key => uint16 // 14
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
Stream => string
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
=== Metadata
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
MetadataQuery => Key Version CorrelationId [Stream]
2021-02-26 18:59:16 +08:00
Key => uint16 // 15
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
Stream => string
2020-05-25 23:02:43 +08:00
2021-01-18 18:25:21 +08:00
MetadataResponse => Key Version CorrelationId [Broker] [StreamMetadata]
2021-02-26 18:59:16 +08:00
Key => uint16 // 15
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
Broker => Reference Host Port
2021-02-26 18:59:16 +08:00
Reference => uint16
2021-01-18 18:25:21 +08:00
Host => string
2021-02-26 18:59:16 +08:00
Port => uint32
2021-01-18 18:25:21 +08:00
StreamMetadata => StreamName LeaderReference ReplicasReferences
StreamName => string
2021-02-26 18:59:16 +08:00
ResponseCode => uint16
LeaderReference => uint16
ReplicasReferences => [uint16]
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
=== MetadataUpdate
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
MetadataUpdate => Key Version MetadataInfo
2021-02-26 18:59:16 +08:00
Key => uint16 // 16
Version => uint16
2021-01-18 18:25:21 +08:00
MetadataInfo => Code Stream
2021-02-26 18:59:16 +08:00
Code => uint16 // code to identify the information
2021-01-18 18:25:21 +08:00
Stream => string // the stream implied
2020-05-25 23:02:43 +08:00
```
2020-06-10 16:42:29 +08:00
=== PeerProperties
```
PeerPropertiesRequest => Key Version PeerProperties
2021-02-26 18:59:16 +08:00
Key => uint16 // 17
Version => uint16
CorrelationId => uint32
2020-06-10 16:42:29 +08:00
PeerProperties => [PeerProperty]
PeerProperty => Key Value
Key => string
Value => string
2021-01-18 18:25:21 +08:00
PeerPropertiesResponse => Key Version CorrelationId ResponseCode PeerProperties
2021-02-26 18:59:16 +08:00
Key => uint16 // 17
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2020-06-10 16:42:29 +08:00
PeerProperties => [PeerProperty]
PeerProperty => Key Value
Key => string
Value => string
```
2021-01-18 18:25:21 +08:00
=== SaslHandshake
2020-09-15 23:52:05 +08:00
```
2021-01-18 18:25:21 +08:00
SaslHandshakeRequest => Key Version CorrelationId Mechanism
2021-02-26 18:59:16 +08:00
Key => uint16 // 18
Version => uint16
CorrelationId => uint32
2020-09-15 23:52:05 +08:00
2021-01-18 18:25:21 +08:00
SaslHandshakeResponse => Key Version CorrelationId ResponseCode [Mechanism]
2021-02-26 18:59:16 +08:00
Key => uint16 // 18
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2021-01-18 18:25:21 +08:00
Mechanism => string
2020-09-15 23:52:05 +08:00
```
2021-01-18 18:25:21 +08:00
=== SaslAuthenticate
2020-11-20 18:43:04 +08:00
```
2021-01-18 18:25:21 +08:00
SaslAuthenticateRequest => Key Version CorrelationId Mechanism SaslOpaqueData
2021-02-26 18:59:16 +08:00
Key => uint16 // 19
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
Mechanism => string
SaslOpaqueData => bytes
2020-11-20 18:43:04 +08:00
2021-01-18 18:25:21 +08:00
SaslAuthenticateResponse => Key Version CorrelationId ResponseCode SaslOpaqueData
2021-02-26 18:59:16 +08:00
Key => uint16 // 19
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2021-01-18 18:25:21 +08:00
SaslOpaqueData => bytes
2020-11-20 18:43:04 +08:00
```
2021-01-18 18:25:21 +08:00
=== Tune
2020-11-20 18:43:04 +08:00
```
2021-01-18 18:25:21 +08:00
TuneRequest => Key Version FrameMax Heartbeat
2021-02-26 18:59:16 +08:00
Key => uint16 // 20
Version => uint16
FrameMax => uint32 // in bytes, 0 means no limit
Heartbeat => uint32 // in seconds, 0 means no heartbeat
2020-11-20 18:43:04 +08:00
2021-01-18 18:25:21 +08:00
TuneResponse => TuneRequest
2020-11-20 18:43:04 +08:00
```
2021-01-18 18:25:21 +08:00
=== Open
2020-11-26 17:02:13 +08:00
```
2021-01-18 18:25:21 +08:00
OpenRequest => Key Version CorrelationId VirtualHost
2021-02-26 18:59:16 +08:00
Key => uint16 // 21
Version => uint16
CorrelationId => uint32
2021-01-18 18:25:21 +08:00
VirtualHost => string
2020-11-26 17:02:13 +08:00
2021-05-21 19:03:38 +08:00
OpenResponse => Key Version CorrelationId ResponseCode ConnectionProperties
2021-02-26 18:59:16 +08:00
Key => uint16 // 21
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2021-05-21 19:03:38 +08:00
ConnectionProperties => [ConnectionProperty]
ConnectionProperty => Key Value
Key => string
Value => string
2020-11-26 17:02:13 +08:00
```
2021-01-18 18:25:21 +08:00
=== Close
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
CloseRequest => Key Version CorrelationId ClosingCode ClosingReason
2021-02-26 18:59:16 +08:00
Key => uint16 // 22
Version => uint16
CorrelationId => uint32
ClosingCode => uint16
2021-01-18 18:25:21 +08:00
ClosingReason => string
CloseResponse => Key Version CorrelationId ResponseCode
2021-02-26 18:59:16 +08:00
Key => uint16 // 22
Version => uint16
CorrelationId => uint32
ResponseCode => uint16
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
=== Heartbeat
2020-05-25 23:02:43 +08:00
```
2021-01-18 18:25:21 +08:00
Heartbeat => Key Version
2021-02-26 18:59:16 +08:00
Key => uint16 // 23
Version => uint16
2020-05-25 23:02:43 +08:00
```
2020-05-25 23:53:34 +08:00
2021-02-26 18:03:36 +08:00
=== Route
_Experimental_
2021-02-26 00:22:42 +08:00
```
RouteQuery => Key Version CorrelationId RoutingKey SuperStream
2021-02-26 18:59:16 +08:00
Key => uint16 // 24
Version => uint16
CorrelationId => uint32
2021-02-26 00:22:42 +08:00
RoutingKey => string
SuperStream => string
RouteResponse => Key Version CorrelationId Stream
2021-02-26 18:59:16 +08:00
Key => uint16 // 24
Version => uint16
CorrelationId => uint32
2021-02-26 00:22:42 +08:00
Stream => string
```
2021-02-26 18:48:45 +08:00
=== Partitions
2021-02-26 00:22:42 +08:00
2021-02-26 18:03:36 +08:00
_Experimental_
2021-02-26 00:22:42 +08:00
```
PartitionsQuery => Key Version CorrelationId SuperStream
2021-02-26 18:59:16 +08:00
Key => uint16 // 25
Version => uint16
CorrelationId => uint32
2021-02-26 00:22:42 +08:00
SuperStream => string
PartitionsResponse => Key Version CorrelationId [Stream]
2021-02-26 18:59:16 +08:00
Key => uint16 // 25
Version => uint16
CorrelationId => uint32
2021-02-26 00:22:42 +08:00
Stream => string
```
2020-05-25 23:53:34 +08:00
== Authentication
Once a client is connected to the server, it initiates an authentication
sequence. The next figure shows the steps of the sequence:
[ditaa]
.Authentication Sequence
....
Client Server
+ +
2020-06-10 16:42:29 +08:00
| Peer Properties Exchange |
|-------------------------->|
|<--------------------------|
| |
2020-05-25 23:53:34 +08:00
| SASL Handshake |
|-------------------------->|
|<--------------------------|
| |
| SASL Authenticate |
|-------------------------->|
|<--------------------------|
| |
| Tune |
|<--------------------------|
|-------------------------->|
| |
| Open |
|-------------------------->|
|<--------------------------|
| |
+ +
....
* SaslHandshake: the client asks about the SASL mechanisms the server supports. It
can then pick one from the list the server returns.
* SaslAuthenticate: the client answers to the server's challenge(s), using the
SASL mechanism it picked. The server will send a `Tune` frame once it is satisfied
with the client authentication response.
2020-05-25 23:56:02 +08:00
* Tune: the server sends a `Tune` frame to suggest some settings (max frame size, heartbeat).
The client answers with a `Tune` frame with the settings he agrees on, possibly adjusted
from the server's suggestions.
* Open: the client sends an `Open` frame to pick a virtual host to connect to. The server
2021-02-22 18:42:34 +08:00
answers whether it accepts the access or not.
2021-07-20 15:55:25 +08:00
== Resources
- [RabbitMQ stream client](https://docs.google.com/presentation/d/1Hlv4qaWm2PRU04dVPmShP9wU7TEQEttXdsbV8P54Uvw/edit#slide=id.gdbeadf9676_0_37): a general guide line to write a stream client
- [RabbitMQ Streams Internals](https://docs.google.com/presentation/d/1BFwf01LcicZ-SyxE1CycZv2gUQMPFGdtFkVuXhgkoTE/edit#slide=id.p1): how the streams work internally