Triggering an Event Using AWS EventBridge Scheduler to SQS at a Specific Time

Triggering an Event Using AWS EventBridge Scheduler to SQS at a Specific Time

Clock Icon2024.06.07 07:55

Introduction

Hello, this is Hemanth from the Alliance Department. In this blog, I will demonstrate how to schedule an event using AWS EventBridge to send messages to an SQS queue at a specific time. This setup can be beneficial for various use cases where time-based event triggering is required.

AWS

Is a secure cloud service platform that offers compute power, database storage, content delivery, network, and other functionality to help businesses scale and grow. It is one of the first cloud vendors to start services in the year 2006. It offers all the 3 service models namely IAAS, PAAS, and SAAS. Some of the notable domains in AWS are Compute, Migration, Storage, Network and Content Delivery, Management Tools, Database, Messaging, Security and Identity Compliance, and many more.

Amazon EventBridge

A serverless event bus solution called Amazon EventBridge enables event-based communication between apps. In order to enable real-time event-driven processing, it integrates applications using data from several AWS services, SaaS apps, and bespoke sources. EventBridge makes it easier to create scalable, decoupled systems by sending events to destinations like Step Functions, SQS queues, and AWS Lambda functions. Event filtering, schema discovery, and automated retries for dependable event delivery are some of its characteristics. EventBridge simplifies the creation of microservices architectures and responsive apps with integrated security and monitoring.

Amazon SQS

It is a web service that enables message exchange between software components at any volume without message loss or the need for additional services to be accessible. It contains standard building blocks like cost allocation tags and dead-letter queues and offers a general web services API that may be used through any programming language that the AWS SDK supports.

Demo

Create an SQS Queue

Navigate to Amazon SQS in the AWS Console. Click on "Create queue". Enter a Name for the Queue. Keep the default settings and click on "Create queue". Queue Successfully Created. The queue setup is now complete.

Create a Schedule in EventBridge

Navigate to Amazon EventBridge in the AWS Console. Click on "Schedules". Click on "Create schedule". Enter a Schedule Name and Configure Timing. Change the one-time schedule settings. Since it’s 16:05 at my location, I’ll choose 16:20 for the event to trigger. Click on "Next". Set the Target API to SQS. Choose the SQS queue created earlier, write a message in the body, and click on "Next". Keep the optional settings as default. Review the configuration, and click on "Create schedule". Schedule Successfully Created. Confirmation of the successful creation.

Verify Message Delivery in SQS

Navigate Back to the SQS Queue. You should see that a message has been received. Now clicking on the Queue. Click on "Send and receive messages". Click on "Poll for messages". Click on the polled message to view it.
The message was successfully delivered from EventBridge to SQS.

Conclusion

In this blog, I demonstrated how to use AWS EventBridge to trigger events and send messages to an SQS queue at a specific time. You can efficiently create time-based messaging systems with this arrangement. You may easily handle time-sensitive data, initiate notifications, and automate operations by utilizing EventBridge's scheduling features.

この記事をシェアする

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.