deleteMessagesFlow

fun <Error class: unknown class>.deleteMessagesFlow(queue: SqsQueue, upstream: Flow<MessageAcknowledgment<Acknowledgment.Delete>>, concurrency: Int = 1, groupStrategy: GroupStrategy = GroupStrategy.TimeWindow(10, 250.milliseconds)): Flow<MessageDeleteResult>

Creates a flow that deletes messages from an Amazon Simple Queue Service (SQS) queue.

This function takes an upstream flow of MessageAcknowledgment objects with a Delete acknowledgment and processes them concurrently using concurrency and the specified groupStrategy.

Return

A Flow that emits pairs of MessageAcknowledgment and DeleteMessageBatchResponse.

Example usage:

val sqsClient: SqsClient = ...
val messageAcknowledgments = flowOf(
MessageAcknowledgment(Message(...), Delete),
MessageAcknowledgment(Message(...), Delete)
)

sqsClient
.deleteMessagesFlow(messageAcknowledgments) {
sqsClient.getQueueUrlByName("myqueue")
}
.collect { (ack, response) ->
println("Deleted message: ${ack.message.messageId()}, response: $response")
}

Parameters

upstream

A Flow of MessageAcknowledgment objects with a Delete acknowledgment.

concurrency

The level of concurrency for processing messages.

groupStrategy

The strategy to use when chunking messages for processing.

queueUrl

A lambda function returning the URL of the Amazon SQS queue.