Transaction Log Tailing pattern message relay implementation.
AWS Lambda function that listens to DynamoDB Streams and publishes messages to SNS topics.
-
Incoming DynamoDB Stream records are processed with partial asynchronous batch processing
-
Messages are marked as dispatched in the
Outbox
table -
Supports
ARM64
andX86_64
platforms
Lambda configuration environment variables are defined in lambda_outbox_dynamodb_streams.app.settings.Settings
-
DYNAMODB_OUTBOX_TABLE_NAME
- DynamoDB Outbox table name (required) -
AWS_ENDPOINT_URL
- AWS endpoint URL (optional, defaults toNone
) -
AWS_SNS_TOPIC_PREFIX
- AWS SNS topic prefix (optional, defaults to an empty string)
-
terraform-transactional-messaging - with Terraform
-
Moto[https://github.com/getmoto/moto] and LocalStack[https://localstack.cloud/] support
DynamoDB Streams + Lambda
integration, so the Transactional Outbox can be easily used in a local environment or with end-to-end automated acceptance tests. -
Deploy the
DynamoDB Streams + Lambda
stack locally withlambda_outbox_dynamodb_streams.outbox.create_dynamodb_streams_outbox
from lambda_outbox_dynamodb_streams.outbox import create_dynamodb_streams_outbox
# Define your AWS clients somewhere in the project `adapters` layer
await create_dynamodb_streams_outbox(
lambda_client,
iam_client,
dynamodb_client,
s3_client,
settings=outbox.Settings(
dynamodb_outbox_table_name=dynamodb_table_name,
aws_endpoint_url=settings.aws_endpoint_url,
aws_sns_topic_prefix=settings.aws_sns_topic_prefix,
),
)
-
Build Lambda
zip
package forlinux/arm64
andlinux/amd64
platforms
docker buildx build --platform linux/arm64 -f Dockerfile.package --target=package --output type=local,dest=$(pwd)/src/lambda_outbox_dynamodb_streams ..
docker buildx build --platform linux/amd64 -f Dockerfile.package --target=package --output type=local,dest=$(pwd)/src/lambda_outbox_dynamodb_streams ..
-
Install dev dependencies with Poetry
poetry install
poetry shell
-
Run tests
pytest
poetry run test-ci
-
Format and lint code
poetry run format
poetry run lint
-
Build package release
poetry build