From 6ebcd25aa951c8abbf9361fbb1d16d35554afb71 Mon Sep 17 00:00:00 2001 From: David Justice Date: Tue, 20 Feb 2018 12:39:28 -0800 Subject: [PATCH] add lastest offset option --- receiver.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/receiver.go b/receiver.go index da6f25b..b8dbef7 100644 --- a/receiver.go +++ b/receiver.go @@ -55,8 +55,6 @@ func ReceiveWithConsumerGroup(consumerGroup string) ReceiveOption { } // ReceiveWithStartingOffset configures the receiver to start at a given position in the event stream -// -// This setting will be overridden by the Hub's OffsetPersister if an offset can be read. func ReceiveWithStartingOffset(offset string) ReceiveOption { return func(receiver *receiver) error { receiver.storeLastReceivedOffset(offset) @@ -64,6 +62,14 @@ func ReceiveWithStartingOffset(offset string) ReceiveOption { } } +// ReceiveWithLatestOffset configures the receiver to start at a given position in the event stream +func ReceiveWithLatestOffset() ReceiveOption { + return func(receiver *receiver) error { + receiver.storeLastReceivedOffset(EndOfStream) + return nil + } +} + // ReceiveWithPrefetchCount configures the receiver to attempt to fetch as many messages as the prefetch amount func ReceiveWithPrefetchCount(prefetch uint32) ReceiveOption { return func(receiver *receiver) error {