samedi 5 septembre 2020

Aws Serverless technologies to poll database

Trying to design a solution for error handling. We have a lambda that receives data from an sns topic and sends data to a legacy service that has been known to be unavailable at times.

When the legacy service is down I want to send the messages to a dyanmodb table to be replayed.

I want to use a circuit breaker pattern. So at the minute I am thinking of spinning up a service that will constantly poll the legacy service then some pseudo code that looks like this

If (legacy service changes from dead to alive){
     Send all entries from dynamo to sns topic;

//This will trigger the lambda again which will hit legacy service which we know is now up
}

The thing is, we like using serverless technologies and not sure I can have a serverless service that constantly polls, it makes sense for that to run on a server.

I am looking for a nice way to do this so I am wondering is it possible to configure dynamodb to poll the legacy service and on the condition it changes from dead to alive populate the sns topic. Or any other solutions using serverless technologies.

P.s I don't like the idea of running a lambda in intervals to check the dB as we could miss some down time, also reading data from dB and sending to sns could be a lengthy operation.

Aucun commentaire:

Enregistrer un commentaire