Class StorageQueueTemplate

java.lang.Object
com.azure.spring.messaging.storage.queue.core.StorageQueueTemplate
All Implemented Interfaces:
SendOperation

public class StorageQueueTemplate extends Object implements 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 Details

    • StorageQueueTemplate

      public StorageQueueTemplate(@NonNull StorageQueueClientFactory storageQueueClientFactory)
      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:
      sendAsync in interface SendOperation
    • receiveAsync

      public Mono<org.springframework.messaging.Message<?>> receiveAsync(String queueName, Duration visibilityTimeout)
      Receive a message from the queue asynchronously.
      Parameters:
      queueName - the queue
      visibilityTimeout - 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:
      Mono of the next available Message or null if empty
    • getMessageConverter

      public StorageQueueMessageConverter getMessageConverter()
      Get the StorageQueueMessageConverter.
      Returns:
      the StorageQueueMessageConverter.
    • setMessageConverter

      public void setMessageConverter(StorageQueueMessageConverter messageConverter)
      Set the StorageQueueMessageConverter.
      Parameters:
      messageConverter - the StorageQueueMessageConverter.
    • getMessagePayloadType

      public Class<?> getMessagePayloadType()
      Get the messagePayloadType.
      Returns:
      the messagePayloadType.
    • setMessagePayloadType

      public void setMessagePayloadType(Class<?> payloadType)
      Set message payload type. Default is byte[]
      Parameters:
      payloadType - message payload type