• 14

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I am working on an Android application where I am storing the lat-long values of multiple devices in Dynamo Db table & trying to fetch them and show their location on map in real time. So I want to know how can I continuously listen for the data changes in Dynamo DB Table. Currently I am using "Timer" which repeats itself every 1 second & fetches the latest values of lat-longs. But then it is not a good solution. Please help me out with this.

You may achieve this by a lambda function which invokes using DynamoDB Streams. So you don't have to periodically pull data, but AWS services will push data to your devices. Basically, when there is a update on Dynamodb, Lambda will process and return the results.

As per your use case I can see two possible paths to retrieve the data processed by lambda.

  1. Once data processed, lambda can invoke SNS topic which your device is subscribed to.
  2. Your device can listen to a socket connection of API Gateway which proxy to the lambda function.

https://docs.aws.amazon.com/lambda/latest/dg/with-ddb-example.html https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html https://aws.amazon.com/blogs/compute/announcing-websocket-apis-in-amazon-api-gateway/

  • 1
Reply Report
    • Ahh.. that sounds nice. Can you please help me more specifically like what would my lambda function look like & what do I exactly need to do?