Search code examples
amazon-web-servicesaws-lambdacircuit-breaker

How to implement circuit pattern in aws lambda


I am implementing an HTTP client in aws lambda. Client will call third party microservice endpoint and that could be down. I want to implement a circuit breaker pattern for obvious advantages of the pattern.

I searched on the net and found one blog: https://www.jeremydaly.com/serverless-microservice-patterns-for-aws/

According to blog, we can maintain state in Elasticache or dynamoDB. But am not able to visualize the implementation. Can someone point me to the right direction? If the implementation is in JAVA that will be awesome.


Solution

  • You need to store the state of the circuit breaker, usually its a java variable. But now you store the state in a external persistance service e.g. dynamodb and check that in java if you open or close the circuit breaker.