0.0.3 • Published 5 years ago

@growsari/sls-event-gateway-subscriber v0.0.3

Weekly downloads
3
License
-
Repository
-
Last release
5 years ago

Serverless Plugin - Event Gateway Subscriber

This Serverless Framework plugin will configure API Gateway connected Lambdas to subscribe to topics in the Growsari Event Bus

Installation

npm install --save @growsari/sls-event-gateway-subscriber

Enviroment Configuration

EVENT_GATEWAY_URL - Base URL of the Growsari Event Bus

Usage

To use the plugin, add the following configurations in serverless.yml

  • Include the package in the plugins
  • Add event_gateway as an event trigger for a function.
  • Add topic as a topic name for the event_gateway event
# serverless.yml

service:  serviceName

provider:
  name:  aws
  runtime:  nodejs10.x

# Add package in plugins
plugins:
  -  "@growsari/sls-event-gateway-subscriber"

functions:
  notificationUrlforTopicName:
    handler: handler.process
    events:
      # Make sure an http event with a POST method is present
      - http:
          path: notify
          method: post
      # Add event_gateway as an event and a topic to subscribe to
      - event_gateway:
          topic:  topicName