Class StorageQueueTemplate
java.lang.Object
com.azure.spring.messaging.storage.queue.core.StorageQueueTemplate
- All Implemented Interfaces:
SendOperation
Azure Storage Queue template to support send / receive
Messages asynchronously.
You should checkpoint if message has been processed successfully, otherwise it will be visible again after certain
time specified by receiveAsync(String, Duration) }.-
Constructor Summary
ConstructorsConstructorDescriptionStorageQueueTemplate(StorageQueueClientFactory storageQueueClientFactory) Create an instance using the supplied StorageQueueClientFactory. -
Method Summary
Modifier and TypeMethodDescriptionAzureMessageConverter<com.azure.storage.queue.models.QueueMessageItem,com.azure.storage.queue.models.QueueMessageItem> Get the message converter.Class<?>Get themessagePayloadType.Mono<org.springframework.messaging.Message<?>>receiveAsync(String queueName, Duration visibilityTimeout) Receive a message from the queue asynchronously.voidsetMessageConverter(AzureMessageConverter<com.azure.storage.queue.models.QueueMessageItem, com.azure.storage.queue.models.QueueMessageItem> messageConverter) Set the message converter to use.voidsetMessagePayloadType(Class<?> payloadType) Set message payload type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.azure.spring.messaging.core.SendOperation
send
-
Constructor Details
-
StorageQueueTemplate
Create an instance using the supplied StorageQueueClientFactory.- Parameters:
storageQueueClientFactory- the StorageQueueClientFactory.
-
-
Method Details
-
sendAsync
public <T> Mono<Void> sendAsync(String queueName, @NonNull org.springframework.messaging.Message<T> message) - Specified by:
sendAsyncin interfaceSendOperation
-
receiveAsync
public Mono<org.springframework.messaging.Message<?>> receiveAsync(String queueName, Duration visibilityTimeout) Receive a message from the queue asynchronously.- Parameters:
queueName- the queuevisibilityTimeout- The timeout period for how long the message is invisible in the queue. If left empty the dequeued messages will be invisible for 30 seconds. The timeout must be between 1 second and 7 days.- Returns:
Monoof the next availableMessageornullif empty
-
getMessageConverter
public AzureMessageConverter<com.azure.storage.queue.models.QueueMessageItem,com.azure.storage.queue.models.QueueMessageItem> getMessageConverter()Get the message converter.- Returns:
- the message converter.
-
setMessageConverter
public void setMessageConverter(AzureMessageConverter<com.azure.storage.queue.models.QueueMessageItem, com.azure.storage.queue.models.QueueMessageItem> messageConverter) Set the message converter to use.- Parameters:
messageConverter- the message converter.
-
getMessagePayloadType
Get themessagePayloadType.- Returns:
- the messagePayloadType.
-
setMessagePayloadType
Set message payload type. Default isbyte[]- Parameters:
payloadType- message payload type
-