I am using below code in a Lambda to emit events to event bridge in AWS.
import { EventBridgeClient, PutEventsCommand } from '@aws-sdk/client-eventbridge';
eventBridge = new EventBridgeClient({
requestHandler: new NodeHttpHandler({
requestTimeout: 5000,
connectionTimeout: 2000,
}),
maxAttempts: 3,
});
await eventBridge.send(new PutEventsCommand(...));
The event bridge has many targets that listen on this event. My question is if the eventBridge.send
async or sync request. I found the my lambda’s duration is very high and when looking at the xray, it shows me all the downstream lambdas who listen on this event from the event bridge. It looks like eventBridge.send
waits until all targets finish processing the event. Is it true? How can I put events to the event bridge without waiting for the targets?