Pardon our mess! We are busy building up docs for our beta users.

Contact us if you need any help getting started, or have any questions at [email protected]

Publisher / Subscriber

Publisher/subscriber -- or pubsub -- functions are a design pattern that allows for decoupling an event from its handler.

Overview

In a serverless architecture, publishing a message effectively calls a function (the subscriber) to handle the message through a message bus. AWS SNS is the message bus provided to coordinate passing messages and callign functions. In order to make use of pubsub, we must define a message channel, called a "topic", and then define the function(s) that will be called in response a message being published to that channel.

Config

The pubsub configuration object is a map, where the map keys are the identifers of the pubsub channel, and the map values are objects defining the channel configuration.

Example:

pubsub:
	my_topic:
		name: My PubSub Topic
		publishers:
			- my_publishing_function
		subscribers:
			- my_subscribing_function

Name

Name is a friendly name for the pubsub channel that will be displayed in the app.

Publishers

Publishers is a list of functions that may publish to the SNS topic. These functions will receive an environment variable named SNS_<topic_name> with the ARN of the created topic and permissions to publish to the topic. In the example above, my_publishing_function will have an environment variable named SNS_my_topic that contains the SNS ARN.

Subscribers

This is a list of functions that will be called when a message is published to the topic. The functions must each be defined in the functions configuration.