Home > Blockchain >  Does DynamoDB allow clients to listen for changes?
Does DynamoDB allow clients to listen for changes?

Time:11-28

I want to build a real time ordering system where users can see what other people have also ordered in near real time. Will DynamoDB with streams allow me to do this?

As a customer
Given there are multiple people ordering
When another customer submits an order
Then I should see that order appear on my screen in near real time

Therefore, I need some way for each front end client to subscribe to changes, ideally without having to poll for changes every second.

As far as I can tell, streams allows me to trigger an action such as running a Lambda function on any udpate event but will it allow me to emit changes to any client / user that is listening for changes as well?

Some alternative options I have already tried is web sockets and GCP Firebase. Both work for my use case but I want to know if there is a way to acheive this within DynamoDB.

CodePudding user response:

Best thing to do here is set up a pub/sub system. There are various ways to achieve this:

DDB -> Streams -> Lambda -> SNS -> Listener

Or via websocket API

DDB -> Streams -> Lambda -> APIGW WebSocket -> Listener

And you can also use Amplify/AppSync PubSub model that allows you to subscribe when you use GraphQL APIs to interact with DynamoDB.

https://docs.aws.amazon.com/appsync/latest/devguide/aws-appsync-real-time-data.html

  • Related