Skip to content

Commit 68025ba

Browse files
committed
Update README.md
1 parent 02be3c0 commit 68025ba

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Benchmarks show that Kotlin Native's "Hello World" Lambda function on Amazon Lin
2323
## Getting started
2424

2525
### 1. Create a Kotlin Multiplatform Project
26-
See [Kotlin Native](https://kotlinlang.org/docs/native-overview.html) for more details.
26+
See [Get started with Kotlin/Native](https://kotlinlang.org/docs/native-get-started.html) for more details.
2727

2828
### 2. Add Dependencies
2929

@@ -81,6 +81,7 @@ class HelloWorldLambdaHandler : LambdaBufferedHandler<APIGatewayV2Request, APIGa
8181
}
8282
}
8383
```
84+
`LambdaBufferedHandler<I, O>` is designed to work with any Kotlin class that is supported by the Kotlin serialization library as both the input and output types. This allows you to define your own custom request and response models annotated with `@Serializable` or utilize existing ones provided by the `lambda-events` module.
8485

8586
#### Streaming
8687
A streaming function sends data as soon as it's available, instead of waiting for all the data. It processes and returns the response in chunks, which is useful for large or ongoing tasks. This allows for faster responses and can handle data as it comes in. [More details here](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html). For example, `SampleStreamingHandler` reads a large json file and streams it in chunks.
@@ -96,6 +97,12 @@ class SampleStreamingHandler : LambdaStreamHandler<ByteArray, ByteWriteChannel>
9697
}
9798
}
9899
```
100+
`LambdaStreamHandler<I, ByteWriteChannel>` accepts any serializable input and outputs to `ByteWriteChannel` which is then streamed to the client.
101+
102+
Both `LambdaBufferedHandler` and `LambdaStreamHandler` are suspend functions, so you can use Kotlin coroutines to handle the request in non-blocking way.
103+
104+
Each handler accepts `Context` object which can be used to get information about the function execution environment, such as the request ID, resource limits, and other details. For more details about the context object, see the [AWS Lambda documentation](https://docs.aws.amazon.com/lambda/latest/dg/c-runtime-context.html).
105+
99106
### 5. Specify Main Function
100107
Create application entry point using standard `main` function. Call `LambdaRuntime.run` to execute Lambda by passing handler to it.
101108

0 commit comments

Comments
 (0)