@@ -134,22 +134,29 @@ func (r *SessionReceiver) newLink(ctx context.Context, session amqpwrap.AMQPSess
134134
135135// ReceiveMessages receives a fixed number of messages, up to maxMessages.
136136// This function will block until at least one message is received or until the ctx is cancelled.
137- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
137+ // If the operation fails it can return an [ *azservicebus.Error] type if the failure is actionable.
138138func (r * SessionReceiver ) ReceiveMessages (ctx context.Context , maxMessages int , options * ReceiveMessagesOptions ) ([]* ReceivedMessage , error ) {
139139 return r .inner .ReceiveMessages (ctx , maxMessages , options )
140140}
141141
142142// ReceiveDeferredMessages receives messages that were deferred using `Receiver.DeferMessage`.
143- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
143+ // If the operation fails it can return an [ *azservicebus.Error] type if the failure is actionable.
144144func (r * SessionReceiver ) ReceiveDeferredMessages (ctx context.Context , sequenceNumbers []int64 , options * ReceiveDeferredMessagesOptions ) ([]* ReceivedMessage , error ) {
145145 return r .inner .ReceiveDeferredMessages (ctx , sequenceNumbers , options )
146146}
147147
148148// PeekMessages will peek messages without locking or deleting messages.
149- // Messages that are peeked do not have lock tokens, so settlement methods
150- // like CompleteMessage, AbandonMessage, DeferMessage or DeadLetterMessage
151- // will not work with them.
152- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
149+ //
150+ // The SessionReceiver stores the last peeked sequence number internally, and will use it as the
151+ // start location for the next PeekMessages() call. You can override this behavior by passing an
152+ // explicit sequence number in [azservicebus.PeekMessagesOptions.FromSequenceNumber].
153+ //
154+ // Messages that are peeked are not locked, so settlement methods like [SessionReceiver.CompleteMessage],
155+ // [SessionReceiver.AbandonMessage], [SessionReceiver.DeferMessage] or [SessionReceiver.DeadLetterMessage] will not work with them.
156+ //
157+ // If the operation fails it can return an [*azservicebus.Error] type if the failure is actionable.
158+ //
159+ // For more information about peeking/message-browsing see https://aka.ms/azsdk/servicebus/message-browsing
153160func (r * SessionReceiver ) PeekMessages (ctx context.Context , maxMessageCount int , options * PeekMessagesOptions ) ([]* ReceivedMessage , error ) {
154161 return r .inner .PeekMessages (ctx , maxMessageCount , options )
155162}
@@ -160,30 +167,30 @@ func (r *SessionReceiver) Close(ctx context.Context) error {
160167}
161168
162169// CompleteMessage completes a message, deleting it from the queue or subscription.
163- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
170+ // If the operation fails it can return an [ *azservicebus.Error] type if the failure is actionable.
164171func (r * SessionReceiver ) CompleteMessage (ctx context.Context , message * ReceivedMessage , options * CompleteMessageOptions ) error {
165172 return r .inner .CompleteMessage (ctx , message , options )
166173}
167174
168175// AbandonMessage will cause a message to be returned to the queue or subscription.
169176// This will increment its delivery count, and potentially cause it to be dead lettered
170177// depending on your queue or subscription's configuration.
171- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
178+ // If the operation fails it can return an [ *azservicebus.Error] type if the failure is actionable.
172179func (r * SessionReceiver ) AbandonMessage (ctx context.Context , message * ReceivedMessage , options * AbandonMessageOptions ) error {
173180 return r .inner .AbandonMessage (ctx , message , options )
174181}
175182
176183// DeferMessage will cause a message to be deferred. Deferred messages
177184// can be received using `Receiver.ReceiveDeferredMessages`.
178- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
185+ // If the operation fails it can return an [ *azservicebus.Error] type if the failure is actionable.
179186func (r * SessionReceiver ) DeferMessage (ctx context.Context , message * ReceivedMessage , options * DeferMessageOptions ) error {
180187 return r .inner .DeferMessage (ctx , message , options )
181188}
182189
183190// DeadLetterMessage settles a message by moving it to the dead letter queue for a
184191// queue or subscription. To receive these messages create a receiver with `Client.NewReceiverForQueue()`
185192// or `Client.NewReceiverForSubscription()` using the `ReceiverOptions.SubQueue` option.
186- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
193+ // If the operation fails it can return an [ *azservicebus.Error] type if the failure is actionable.
187194func (r * SessionReceiver ) DeadLetterMessage (ctx context.Context , message * ReceivedMessage , options * DeadLetterOptions ) error {
188195 return r .inner .DeadLetterMessage (ctx , message , options )
189196}
@@ -207,7 +214,7 @@ type GetSessionStateOptions struct {
207214}
208215
209216// GetSessionState retrieves state associated with the session.
210- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
217+ // If the operation fails it can return an [ *azservicebus.Error] type if the failure is actionable.
211218func (sr * SessionReceiver ) GetSessionState (ctx context.Context , options * GetSessionStateOptions ) ([]byte , error ) {
212219 var sessionState []byte
213220
@@ -232,7 +239,7 @@ type SetSessionStateOptions struct {
232239
233240// SetSessionState sets the state associated with the session.
234241// Pass nil for the state parameter to clear the stored session state.
235- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
242+ // If the operation fails it can return an [ *azservicebus.Error] type if the failure is actionable.
236243func (sr * SessionReceiver ) SetSessionState (ctx context.Context , state []byte , options * SetSessionStateOptions ) error {
237244 err := sr .inner .amqpLinks .Retry (ctx , EventReceiver , "SetSessionState" , func (ctx context.Context , lwv * internal.LinksWithID , args * utils.RetryFnArgs ) error {
238245 return internal .SetSessionState (ctx , lwv .RPC , lwv .Receiver .LinkName (), sr .SessionID (), state )
@@ -248,7 +255,7 @@ type RenewSessionLockOptions struct {
248255
249256// RenewSessionLock renews this session's lock. The new expiration time is available
250257// using `LockedUntil`.
251- // If the operation fails it can return an *azservicebus.Error type if the failure is actionable.
258+ // If the operation fails it can return an [ *azservicebus.Error] type if the failure is actionable.
252259func (sr * SessionReceiver ) RenewSessionLock (ctx context.Context , options * RenewSessionLockOptions ) error {
253260 err := sr .inner .amqpLinks .Retry (ctx , EventReceiver , "RenewSessionLock" , func (ctx context.Context , lwv * internal.LinksWithID , args * utils.RetryFnArgs ) error {
254261 newLockedUntil , err := internal .RenewSessionLock (ctx , lwv .RPC , lwv .Receiver .LinkName (), * sr .sessionID )
0 commit comments