Serverless Functions are well suited for Event driven applications and the event sources trigger the invocation of the functions. Events are treated as first class citizens and Functions as a Service (FaaS) providers like AWS Lambda, Azure Functions, Catalyst and Google Functions provide support for various services to act as the event source that triggers the function containing the code. Event can be considered as a change in the state of a system. It could be as simple as an addition of a file in cloud storage to more complex ones. The triggers are set in through a direct invocation from the SDK, HTTP requests via API gateway or other cloud service. The trigger then invokes the Serverless Function code. While the FaaS offered by different cloud providers provide support for event driven architectures, the event sources supported by these cloud providers vary. In this post, we will discuss some of the event sources supported by the cloud providers and how they handle the triggers to invoke the Serverless functions.
AWS Lambda event sources
AWS Lambda supports multiple event source types as triggers invoking the function code using EventSource Mapping, an AWS Lambda resource that reads from the event source and invokes the Lambda functions. Various AWS services and API Gateway can act as event sources. They are AlexaSkill, API, CloudWatchEvent, CloudWatchLogs, Cognito, DynamoDB, EventBridgeRule, HTTPApi, IOTRule, Kinesis, MSK, S3, Schedule, SNS and SQS. AWS EventBridge uses the same technology as CloudWatch Events but allows the developers to build their own events.
Azure Functions event sources
Azure Functions uses Azure Event Grid to build event driven applications. Axure Event Grid connects Event Sources with Event Handlers, one of which is Azure Functions, giving flexibility for developers to build custom events. Event Grid has built-in support for events coming from Azure services, like storage blobs and resource groups and also support for custom events. Events cav be routed to different endpoints or multicast to multiple endpoints. Various event sources supported by Azure EventGrid are Azure App Configuration, Azure Blob Storage,Azure Communication Services, Azure Container Registry, Azure Event Hubs, Azure IoT Hub, Azure Key Vault, Azure Machine Learning, Azure Maps, Azure Media Services, Azure resource groups, Azure Service Bus, Azure SignalR and Azure subscriptions.
Catalyst is a new Serverless offering by Zoho and it comes with some unique advantages over other competing offerings in the market. Catalyst supports event driven applications using Event Listeners, an event service bus that connects various web components with activities in the application. Event listeners listen for the occurrences of predetermined events and automatically execute custom actions upon their occurrences. There are two types of event listeners in Catalyst. Default event listeners that connect components such as Data Store, Cache, User Management, File Store, Github and WebApp to various application activities and Custom event listeners which are custom events which when invoked by users using the URL that is generated will trigger the function. Using Catalyst event listeners, developers can create automation of application logic like creating an OCR every time a PDF is uploaded, delivering real time data, parallel processing and insights from monitoring and logging data.
Google Cloud Functions offers limited support for event sources compared to other providers. They offer support for HTTP, Cloud Storage, Cloud Pub/Sub, Cloud Firestore, Firebase and Stackdriver logging.
Even though event sources may appear to be less important compared to various features offered by Serverless Functions, it is critical in deciding the right Serverless Functions service for your organization. If the service doesn’t support the right event sources that is needed to trigger your functions, you should check the support for custom events and see if it will meet your needs. The support for various event sources and the support for custom events should be a critical factor in your evaluation of the Serverless Functions platform.