receiveMessagesAsFlow

fun QueueAsyncClient.receiveMessagesAsFlow(concurrency: ConcurrencyStrategy = ConcurrencyStrategy.disabled, pollSize: Int = 32, visibilityTimeout: Duration = 30.seconds, stopOnEmptyList: Boolean = false): Flow<QueueMessageItem>

Continuously receives messages from an Azure Storage Queue using the provided QueueAsyncClient. The received messages are returned as a Flow of QueueMessageItem objects.

Return

A flow of QueueMessageItem objects.

Example usage:

val queueAsyncClient = QueueClientBuilder().queueName("name").buildAsyncClient()
val messagesFlow = queueAsyncClient.receiveMessagesAsFlow()
messagesFlow.collect { message -> println(message) }

Parameters

concurrency

The ConcurrencyStrategy to control the number of concurrent polling operations allowed. Defaults to a static strategy with concurrency of 1.

pollSize

The maximum number of messages to retrieve per poll request. Defaults to 32.

visibilityTimeout

The visibility timeout for messages retrieved from the queue. Defaults to 30 seconds.

stopOnEmptyList

If true, the flow will stop when an empty list of messages is received. Defaults to false.