最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to implement transactional outbox pattern with AWS Lambda and PostgreSQL - Stack Overflow

programmeradmin1浏览0评论

I use AWS Lambda function to respond to HTTP requests.

The function stores some data in a PostgreSQL database. To reliably notify interested parties of the changes, I use transactional outbox pattern.

In scope of the same transaction I store an outgoing message to PostgreSQL. Then SNS client should process outbox in a different transaction.

Ideally processing outbox should happen after I send response to the original HTTP request. The issue is that once response is sent, Lambda function freezes.

One way to work around the freeze is to use Lambda extension. Although, extension lifecycle doesn't have a hook for "Lambda call completed" event.

AWS documentation provides an example for a database that supports change data capture (.html). But that is not the case with PostgreSQL.

As of now for simplicity I process outbox before sending response, but I'd like to improve it.

What is the correct approach to use in this case?

发布评论

评论列表(0)

  1. 暂无评论