invokeFlow
inline fun <T> <Error class: unknown class>.invokeFlow(upstream: Flow<T>, concurrency: Int = 1, crossinline builder: <Error class: unknown class>.(T) -> Unit): Flow<<Error class: unknown class>>
Creates a flow that invokes an AWS Lambda function with the specified builder request.
This function takes an upstream flow of input byte arrays and invokes the specified Lambda function with the given parameters concurrently based on the provided concurrency.
Return
A Flow of InvokeResponse objects.
Example usage:
val lambdaClient: LambdaAsyncClient = ...
val functionName =
val inputs = flowOf("input1", "input2", "input3")
lambdaClient
.invokeFlow(inputs, concurrency = 10) { item ->
functionName = "my-lambda-function"
payload = item.encodeToByteArray()
}
.collect { response ->
println("Lambda invocation response: $response")
}
Content copied to clipboard
Parameters
upstream
A ByteArray based Flow of input payloads.
concurrency
The level of concurrency for invoking the Lambda function.
builder
The InvokeRequest's builder