GithubHelp home page GithubHelp logo

spuds51 / amazon-eventbridge-producer-consumer-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-samples/amazon-eventbridge-producer-consumer-example

0.0 2.0 0.0 14 KB

A simple producer/consumer example for Amazon EventBridge. Questions? @jbesw.

Home Page: https://aws.amazon.com/blogs/compute/integrating-amazon-eventbridge-into-your-serverless-applications/

License: MIT No Attribution

JavaScript 100.00%

amazon-eventbridge-producer-consumer-example's Introduction

Amazon EventBridge - Producer/Consumer example

This example application creates two AWS Lambda functions - a producer and a consumer. The SAM template deploys these functions, together with an EventBridge rule that determines which events are routed to the consumer.

The example shows how an ATM application at a bank could generate events, and the rule only passes 'approved' transactions to an event consuming application.

Important: this application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the AWS Pricing page for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.

For more blogs and examples, visit Serverless Land.

.
├── README.MD                   <-- This instructions file
├── atmProducer                 <-- Source code for a lambda function
│   └── handler.js              <-- Main Lambda handler
│   └── events.js               <-- Events
│   └── localTest.js            <-- Wrapper for local testing
│   └── package.json            <-- NodeJS dependencies and scripts
├── atmConsumer                 <-- Source code for a lambda function
│   └── handler.js              <-- Main Lambda handler
├── template.yaml               <-- SAM template

Requirements

Installation Instructions

  1. Create an AWS account if you do not already have one and login.

  2. Install Git and install the AWS Serverless Application Model CLI on your local machine.

  3. Create a new directory, navigate to that directory in a terminal and enter https://github.com/aws-samples/amazon-eventbridge-producer-consumer-example.

  4. From the command line, run:

cd ./amazon-eventbridge-producer-consumer-example
sam deploy --guided

Choose a stack name, select the desired AWS Region, and allow SAM to create roles with the required permissions. Once you have run guided mode once, you can use sam deploy in future to use these defaults.

How it works

  • Use the AWS CLI or AWS Lambda Console to invoke the Producer function. This places the events in events.js onto the default event bus in EventBridge.
  • The EventBridge rule specified in template.yaml filters the events based upon the criteria in the EventPattern section.
  • When the rule validates an event, it is routed to the Consumer function. This logs out the event, which you can see in CloudWatch Logs.

==============================================

Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: MIT-0

amazon-eventbridge-producer-consumer-example's People

Contributors

amazon-auto avatar jbesw avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.