Skip to content

Commit 8ae5dbf

Browse files
authored
Merge branch 'main' into super_stream_consumer_doc
2 parents 32fc0d7 + 0324edc commit 8ae5dbf

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

pkg/stream/consumer.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,12 @@ func (consumer *Consumer) QueryOffset() (int64, error) {
432432
SetOffset constants
433433
*/
434434
const (
435-
typeFirst = int16(1)
436-
typeLast = int16(2)
437-
typeNext = int16(3)
438-
typeOffset = int16(4)
439-
typeTimestamp = int16(5)
435+
typeFirst = int16(1)
436+
typeLast = int16(2)
437+
typeNext = int16(3)
438+
typeOffset = int16(4)
439+
typeTimestamp = int16(5)
440+
// Deprecated: see LastConsumed()
440441
typeLastConsumed = int16(6)
441442
)
442443

@@ -476,13 +477,25 @@ func (o OffsetSpecification) isOffset() bool {
476477
return o.typeOfs == typeOffset || o.typeOfs == typeLastConsumed
477478
}
478479

480+
// Deprecated: see LastConsumed()
479481
func (o OffsetSpecification) isLastConsumed() bool {
480482
return o.typeOfs == typeLastConsumed
481483
}
482484
func (o OffsetSpecification) isTimestamp() bool {
483485
return o.typeOfs == typeTimestamp
484486
}
485487

488+
// Deprecated: The method name may be misleading.
489+
// The method does not indicate the last message consumed of the stream but the last stored offset.
490+
// The method was added to help the user, but it created confusion.
491+
// Use `QueryOffset` instead.:
492+
//
493+
// offset, err := env.QueryOffset(consumerName, streamName)
494+
// // check the error
495+
// ....
496+
// SetOffset(stream.OffsetSpecification{}.Offset(offset)).
497+
//
498+
// So in this way it possible to start from the last offset stored and customize the behavior
486499
func (o OffsetSpecification) LastConsumed() OffsetSpecification {
487500
o.typeOfs = typeLastConsumed
488501
o.offset = -1

0 commit comments

Comments
 (0)