Skip to content

⏳ A lambda function used to schedule notifications using AWS SQS, SNS and CloudWatch

License

Notifications You must be signed in to change notification settings

adisakshya/custom-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version MIT License PR's Welcome Code of Conduct

Overview

The notification-scheduler is a lambda-function that is invoked using a cloud-watch schedule that triggers every 1 minute.

  • All notifications created by the clients are stored in the PostgreSQL notifications-database by the event-service with all the information required to send the notification to the client.
  • When the notification-scheduler is invoked it retrieves the notification from the notification-database that are to be delivered in the next minute and forward them to the notification-sns-topic as notificaton-messages.
  • The notification-sqs-queue subscribed to the notification-sns-topic recieves the notification-message as soon as it is published to the sns-topic.
  • The notification-service continuously polls the notification-sqs-queue and send the incoming notification to the clients.

Operating Instructions

Fork

  • Fork this repository
    • "Forking" adds a copy of adisakshya/custom-scheduler repository to your GitHub account as https://github.com/YourGitHubUserName/custom-scheduler
  • Or you can download or clone this repository
    • You can clone the repository executing below command in a location of your choice in your system
    • $ git clone https://github.com/adisakshya/custom-scheduler.git
  • Source code for the custom-scheduler can be found at /src
  • Serverless configuration is defined at /src/serverless.yml

Local Development

Prerequisites

  • Make sure you have
    • Installed the severless framework
    • PostgreSQL notification-database running and is accessible using host-url, username and password
    • AWS SNS notification-topic setup and is accessible using ARN

Starting the scheduler

  • In source directory src/ run the following command
    • $ yarn install - install required dependencies
    • $ yarn build - build source code
    • $ yarn test - run test (optional)
    • $ yarn start - start the scheduler
  • On successful start, the scheduler will be invoked every 1 minute and will start forwarding the notifications in the notification-database to the notification-sns-topic.

Contributing

There are multiple ways to contribute to this project, read about them here.

License

All versions of the app are open-sourced, read more about this LICENSE.