sam-goodwin / punchcard

Type-safe AWS infrastructure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EventBridge support

coder17934 opened this issue · comments

Hi,

This project looks great, can't believe that I haven't seen it before! I would love to help out by adding support for EventBrige but before I get started I just wanted to check if you already had any thoughts on how to implement is so I don't veer off course?

Thanks

commented

Hey, thanks for your interest in Punchcard! I'd love to work with you to add support for this.

I haven't thought much about EventBridge other than it seems to be a source of data that adheres to some type. i.e. EventBridge<T extends Shape>? Do you think it's similar to a SQS.Queue<T extends Shape> in how it will be used? E.g. "for each event in this source, invoke this lambda function".

If so, then it might follow the Stream pattern which gives you methods for chaining computations from an EventSource, e.g. forEach, map, flatMap etc.

See: https://github.com/punchcard/punchcard/blob/master/packages/punchcard/lib/util/stream.ts
SQS is a simple example of how this pattern is implemented: https://github.com/punchcard/punchcard/tree/master/packages/punchcard/lib/sqs

That's great, my first port of call was to look at the SNS implementation. EventBridge is essentially a serverless pub/sub system with flexible rules when it comes to routing. I think they routing rule piece could be really interesting, I saw that you have a jsonpath shape package so that might be a good start.

Either way, I'll get cracking on a fork so you can have visibility and steer in terms of direction.

commented

Oh that will be interesting. I took a quick look at https://link.medium.com/9JBEiQCRG9

Looks like JSON path covers most of the complexity. The transformer input will need to infer a new shape from the transformed data. I think that might be the trickiest bit, but definitely achievable.

Do you use Slack or Gitter or something like that? Just for one-off questions as I look through the code? I don't want to pollute this issue with my random questions.

commented

I have a slack: https://join.slack.com/t/punchcard-dev/shared_invite/zt-h5t4hlmv-ZBXhggP9QXrnkRwED7GKrA

There’s only a couple of people in there. Come on by!