Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Publishing events to event bus using put-events API call is fully synchronous and blocks until event is dispatched by destinations.
Expected Behavior
The put-events API call should be non-blocking and should complete once the event is accepted by the bus. Further processing and routing of the event should be done fully asynchronously.
How are you starting LocalStack?
With a docker-compose file
Steps To Reproduce
How are you starting localstack (e.g., bin/localstack
command, arguments, or docker-compose.yml
)
docker run localstack/localstack
Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
Deploy terraform below to provision event bus
resource "aws_cloudwatch_event_bus" "local_event_bus" {
name = "local-event-bus"
}
resource "aws_cloudwatch_event_api_destination" "local_api_destination" {
name = "local-api-destination"
connection_arn = aws_cloudwatch_event_connection.local_connection.arn
invocation_endpoint = "http://host.docker.internal:8080"
http_method = "POST"
}
resource "aws_cloudwatch_event_connection" "local_connection" {
name = "local-connection"
authorization_type = "BASIC"
auth_parameters {
basic {
username = "local_user"
password = "local_password"
}
}
}
resource "aws_cloudwatch_event_rule" "test_event_rule" {
event_bus_name = aws_cloudwatch_event_bus.local_event_bus.name
event_pattern = jsonencode({
source = ["test.source"]
})
}
resource "aws_cloudwatch_event_target" "test_event_target" {
rule = aws_cloudwatch_event_rule.test_event_rule.name
arn = aws_cloudwatch_event_api_destination.local_api_destination.arn
event_bus_name = aws_cloudwatch_event_bus.local_event_bus.name
}
Start local listener on port 8080 with nc
nc -l 8080
In a separate terminal send the event to the event bus:
awslocal events put-events --entries '[
{
"Source": "test.source",
"DetailType": "dummy-message",
"Detail": "{\"id\": \"123\", \"name\": \"123\"}",
"EventBusName": "local-event-bus"
}
]'
The above API call blocks forever. At this point go back to the previous terminal where the nc
listener is running. You should see the input payload. Pressing enter on that terminal completes the request and the pub-events
will only complete after that.
Environment
- OS:
- LocalStack:
LocalStack version: 4.0.4.dev79
LocalStack Docker image sha: sha256:cccfdbda6934d0b636741731d59bcf331fc9b766e3dbdbb9a3ef4551a797ddd4
LocalStack build date: 2025-01-06
LocalStack build git hash: 3af3830af
Anything else?
No response