Skip to content

Commit 305ba21

Browse files
committed
Documentation [skip ci]
Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent cf01457 commit 305ba21

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

RabbitMQ.Stream.Client/RawConsumer.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,24 @@
1010

1111
namespace RabbitMQ.Stream.Client
1212
{
13+
/// <summary>
14+
/// MessageContext contains message metadata information
15+
///
16+
/// </summary>
1317
public struct MessageContext
1418
{
19+
/// <summary>
20+
/// Message offset inside the log
21+
/// each single message has its own offset
22+
/// </summary>
1523
public ulong Offset { get; }
1624

25+
/// <summary>
26+
/// The timestamp of the message chunk.
27+
/// A chunk (usually) contains multiple messages
28+
/// The timestamp is the same for all messages in the chunk.
29+
/// A chunk is simply a batch of messages.
30+
/// </summary>
1731
public TimeSpan Timestamp { get; }
1832

1933
public MessageContext(ulong offset, TimeSpan timestamp)

RabbitMQ.Stream.Client/Reliable/Consumer.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,42 @@ public record ConsumerConfig : ReliableConfig
2323
// </summary>
2424
public string ClientProvidedName { get; set; } = "dotnet-stream-conusmer";
2525

26+
// <summary>
27+
// Function where the consumer receives the messages.
28+
// Parameters:
29+
// - string: the stream name where the message was published
30+
// - MessageContext: Context of the message, see <see cref="RawConsumer.MessageContext"/>
31+
// - Message: the decode message received
32+
// </summary>
2633
public Func<string, RawConsumer, MessageContext, Message, Task> MessageHandler { get; set; }
2734

35+
// <summary>
36+
// Enable the SuperStream stream feature.
37+
// See also: https://blog.rabbitmq.com/posts/2022/07/rabbitmq-3-11-feature-preview-super-streams
38+
// Parameters:
2839
public bool IsSuperStream { get; set; }
40+
41+
// <summary>
42+
// The offset is the place in the stream where the consumer starts consuming from. The possible values for the offset parameter are the following:
43+
// - OffsetTypeFirst: starting from the first available offset. If the stream has not been truncated, this means the beginning of the stream (offset 0).
44+
// - OffsetTypeLast: starting from the end of the stream and returning the last chunk of messages immediately (if the stream is not empty).
45+
// - OffsetTypeNext: starting from the next offset to be written. Contrary to OffsetTypeLast, consuming with OffsetTypeNext will not return anything if no-one is publishing to the stream. The broker will start sending messages to the consumer when messages are published to the stream.
46+
// - OffsetTypeOffset(offset): starting from the specified offset. 0 means consuming from the beginning of the stream (first messages). The client can also specify any number, for example the offset where it left off in a previous incarnation of the application.
47+
// - OffsetTypeTimeStamp(timestamp): starting from the messages stored after the specified timestamp.
48+
// </summary>
2949
public IOffsetType OffsetSpec { get; set; } = new OffsetTypeNext();
3050

51+
// <summary>
52+
// When the single active consumer feature is enabled for several consumer instances sharing the same stream and name, only one of these instances will be active at a time and so will receive messages.
53+
// The other instances will be idle.
54+
// </summary>
3155
public bool IsSingleActiveConsumer { get; set; } = false;
56+
57+
// <summary>
58+
// The broker notifies a consumer that becomes active before dispatching messages to it.
59+
// With ConsumerUpdateListener the consumer can decide where to start consuming from.
60+
// The event is raised only in case of single active consumer.
61+
// </summary>
3262
public Func<string, string, bool, Task<IOffsetType>> ConsumerUpdateListener { get; set; } = null;
3363

3464
public ConsumerConfig(StreamSystem streamSystem, string stream) : base(streamSystem, stream)

0 commit comments

Comments
 (0)