com.microsoft.azure.servicebus.ReceiveMode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-servicebus Show documentation
Show all versions of azure-servicebus Show documentation
Java library for Azure Service Bus. Please note, a newer package com.azure:azure-messaging-servicebus for Azure Service Bus is available as of December 2020. While this package will continue to receive critical bug fixes, we strongly encourage you to upgrade. Read the migration guide at https://aka.ms/azsdk/java/migrate/sb for more details.
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package com.microsoft.azure.servicebus;
/**
* Enumeration to represent the two receive modes Azure Service Bus supports.
*
* @since 1.0
*/
public enum ReceiveMode {
/**
* In this mode, received message is not deleted from the queue or subscription, instead it is temporarily locked to the receiver, making it invisible to other receivers. Then the service waits for one of the three events
*
* - If the receiver processes the message successfully, it calls
complete
and the message will be deleted.
* - If the receiver decides that it can't process the message successfully, it calls
abandon
and the message will be unlocked and made available to other receivers.
* - If the receiver wants to defer the processing of the message to a later point in time, it calls
defer
and the message will be deferred. A deferred can only be received by its sequence number.
* - If the receiver wants to dead-letter the message, it calls
deadLetter
and the message will be moved to a special sub-queue called deadletter queue.
* - If the receiver calls neither of these methods within a configurable period of time (by default, 60 seconds), the service assumes the receiver has failed. In this case, it behaves as if the receiver had called
abandon
, making the message available to other receivers
*
*/
PEEKLOCK,
/**
* In this mode, received message is removed from the queue or subscription and immediately deleted. This option is simple, but if the receiver crashes
* before it finishes processing the message, the message is lost. Because it's been removed from the queue, no other receiver can access it.
*/
RECEIVEANDDELETE
}