Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
As messages are added to a queue in a broker, they are assigned an incrementing
sequence number. Messages delivered to subscribers can be updated to include
the sequence number if the `include-seq` header is added to the `SUBSCRIBE`
frame. This header should be set to a header name which will be added
messages delivered to hold value of the sequence number.
Example:
SUBSCRIBE
id:mysub
destination:/queue/foo
include-seq:seq
^@
Then you can expect to receive messages like:
MESSAGE
subscription:mysub
destination:/queue/foo
seq:1
Hello
^@
MESSAGE
subscription:mysub
destination:/queue/foo
seq:2
World
^@
Furthermore, you configure the `SUBSCRIBE` frame so that the subscription
only receives messages that have a sequence id that is equal to or greater
than a requested value by using the `from-seq` header. Example:
SUBSCRIBE
id:mysub
destination:/queue/foo
from-seq:10
^@
If the `from-seq` is set to `-1`, then the subscription will receive messages
from the tail of the queue. In other words, it will only receive new messages sent
to the queue.
Note: You can only use the `from-seq` header with normal destinations. If you
attempt to use it with a wildcard or composite destination then the connection
will be closed due to invalid usage.