serverless / event-gateway

React to any event with serverless functions across clouds
https://www.serverless.com/event-gateway
Apache License 2.0
1.65k stars 96 forks source link

Async HTTP subscriptions #207

Open brianneisler opened 7 years ago

brianneisler commented 7 years ago

This is a Feature Request

Description

It would be convenient to allow for one sync subscription and multiple async subscriptions on an http event. Then multiple async handlers could be used for logging, metrics, etc.

Use-cases

Concepts

Questions

Examples

# serverless.yml
service:
  name: users

functions:
  usersCreate:
    handler: users.create
    events:
      - http: # Creates a Subscription with a synchronous Function call
          path: users
  logRequest:
    handler: request.logger
    events:
      - http: # Creates a Subscription with an asynchronous Function call
          path: users
          async: true
shortjared commented 7 years ago

My main use case here stems more wanting to bring the concept of event subscriptions to arbitrary HTTP events, mostly for integrations with other third party webhook based systems. (GitHub, Datadog, Zendesk, Zapier, etc)

A toy example. I want to allow multiple subscribers to a github webhook, because different subscribers may care about the same github event in different ways and independently of one another. POST /github/project-acme would then allow async subscribers department A to create an alert in slack, department B to create a ticket in JIRA to review it, and department C to flash their IoT lights if it was a release.

mthenw commented 7 years ago

@shortjared thanks for insights! As I understand your use case it would be solved by https://github.com/serverless/event-gateway/issues/194, right? You don't want to specify a path with that. Just an ability to create async subscription emitted by webhook.