Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNM: kinesis support for bridge #924

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

svix-onelson
Copy link
Contributor

@svix-onelson svix-onelson commented May 15, 2023

Do not merge. Only a partial impl.

Needs consumer APIs which are not yet implemented in the SDK awslabs/aws-sdk-rust#213

Much of the code in the new kinesis module is actually copypasta from SQS, so don't be fooled. It probably looks more complete than it is.

svix-onelson and others added 8 commits May 8, 2023 14:33
This is a copy/paste from the repo where this work was being done
originally.
Embeds a deno runtime in the bridge binary to allow ad hoc reshaping of
messages read from queues before they are sent to Svix.

## Motivation

When consuming JSON from messaging systems to generate new webhooks,
it's common to need to transform the payload before making the Create
Message request to Svix.

## Solution

Embedding a JS runtime into the bridge process allows us to run
user-defined functions on the payloads as they move from input to
output.

With this diff, plugin instances provided by
`svix-webhook-bridge-plugin-queue-consumer` can now evaluate js included
in the plugin config:
```yaml
plugins:
- type: "rabbitmqconsumer"
  input:
    uri: "amqp://guest:guest@localhost:5672/%2f"
    queue_name: "local"
    requeue_on_nack: false
  transformation: | 
    function handler(input) {
      return { 
        app_id: input.key, 
        message: { 
          eventType: input.event_type, 
          payload: input.data 
        }
      };
    }
  output:
    token: "***************"
```

The `transformation` key can now be set on any of these consumers. The
JS fragment should include a default export of a function that accepts
an object and returns an object.

These functions can be used to reshape the payload as necessary.
Very incomplete/untested. The sdk doesn't seem to have APIs for consuming.

Follow <awslabs/aws-sdk-rust#213> for updates
on the sdk side.
@svix-onelson svix-onelson force-pushed the onelson/bridge branch 2 times, most recently from c2f47e8 to e567257 Compare May 30, 2023 21:19
Base automatically changed from onelson/bridge to main May 31, 2023 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant