From 5b75b79bb13c51ab3da81fde3bb3529b14dae637 Mon Sep 17 00:00:00 2001 From: Darwin Boersma Date: Fri, 4 Oct 2024 07:20:34 -0600 Subject: [PATCH 1/2] spin kinesis trigger plugin Signed-off-by: Darwin Boersma --- .../api/hub/plugin_spin_kinesis_trigger.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 content/api/hub/plugin_spin_kinesis_trigger.md diff --git a/content/api/hub/plugin_spin_kinesis_trigger.md b/content/api/hub/plugin_spin_kinesis_trigger.md new file mode 100644 index 000000000..e57325f2d --- /dev/null +++ b/content/api/hub/plugin_spin_kinesis_trigger.md @@ -0,0 +1,77 @@ +title = "Kinesis Trigger" +template = "render_hub_content_body" +date = "2024-10-04T00:22:56Z" +content-type = "text/plain" +tags = ["trigger", "rust", "plugins"] + +[extra] +author = "ogghead" +type = "hub_document" +category = "Plugin" +language = "Rust" +created_at = "2024-08-31T00:22:56Z" +last_updated = "2024-10-04T00:22:56Z" +spin_version = ">=v2.6.0" +summary = "An experimental Kinesis trigger for Spin apps" +url = "https://github.com/ogghead/spin-trigger-kinesis" +keywords = "trigger, kinesis" + +--- + +An experimental plugin that enables AWS Kinesis trigger for Spin applications. + +## Installing Plugin + +You can install the plugin using the following command: + +```sh +spin plugins install --url https://github.com/ogghead/spin-trigger-kinesis/releases/download/canary/trigger-kinesis.json +``` + +## Installing Template + +You can install the template using the following command: + +```sh +spin templates install --git https://github.com/ogghead/spin-trigger-kinesis +``` + +Once the template is installed, you can create a new application using: + +```sh +spin new -t kinesis-rust hello_kinesis --accept-defaults +``` + +Note that you will need to provide a valid ARN (Amazon Resource Name) for your stream. + +To run the newly created app: + +```bash +cd hello_kinesis +spin build --up +``` + +### Configuring the Kinesis Trigger + +The trigger type is `kinesis` and there are no application-level configuration options. + +The following options are available to set in the [[trigger.kinesis]] section: + +| Name | Type | Required? | Description | +|-----------------------------|------------------|-----------|-------------| +| `stream_arn` | string | required | The stream to which this trigger listens and responds. | +| `batch_size` | number | optional | The maximum number of records to fetch per Kinesis shard on each poll. The default is 10. This directly affects the amount of records that your component is invoked with. | +| `shard_idle_wait_millis` | number | optional | How long (in milliseconds) to wait between checks when the stream is idle (i.e. when no messages were received on the last check). The default is 1000. If the stream is _not_ idle, there is no wait between checks. The idle wait is also applied if an error occurs. Note that this number should _not_ exceed 300,000 milliseconds (5 minutes), as shard iterators time out after this period | +| `detector_poll_millis` | number | optional | How long (in milliseconds) to wait between checks for new shards. The default is 30,000 (30 seconds). | +| `shard_iterator_type` | enum | optional | See for possible options. Defaults to LATEST. | +| `component` | string or table | required | The component to run when a stream record is received. This is the standard Spin trigger component field. | + +```toml +[[trigger.kinesis]] +component = "test" +stream_arn = "arn:aws:kinesis:us-east-1:1234567890:stream/TestStream" +batch_size = 1000 +shard_idle_wait_millis = 250 +detector_poll_millis = 30000 +shard_iterator_type = "TRIM_HORIZON" +``` From b5945d169e250382b17f8839731c94f6e3dff4ef Mon Sep 17 00:00:00 2001 From: Darwin Boersma Date: Mon, 7 Oct 2024 08:19:37 -0600 Subject: [PATCH 2/2] Update plugin_spin_kinesis_trigger.md Co-authored-by: Karthik Ganeshram Signed-off-by: Darwin Boersma --- content/api/hub/plugin_spin_kinesis_trigger.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/api/hub/plugin_spin_kinesis_trigger.md b/content/api/hub/plugin_spin_kinesis_trigger.md index e57325f2d..7ff35e583 100644 --- a/content/api/hub/plugin_spin_kinesis_trigger.md +++ b/content/api/hub/plugin_spin_kinesis_trigger.md @@ -33,7 +33,7 @@ spin plugins install --url https://github.com/ogghead/spin-trigger-kinesis/relea You can install the template using the following command: ```sh -spin templates install --git https://github.com/ogghead/spin-trigger-kinesis +spin templates install --update --git https://github.com/ogghead/spin-trigger-kinesis ``` Once the template is installed, you can create a new application using: