v1.7.13
Features
Bulk emit events
This release contains an improvement of the events system in Medusa. We've updated the EventBusService.emit
method to now support bulk emitting a collection of events. This is useful in bulk upsert scenarios and significantly improves performance.
Note, these changes are backward compatible so that you can use emit to send a single event, as usual.
Single emit
await eventBusService.emit("product.created", { id: product.id }, { attempts: 4 })
Bulk emit
let events = [
{
eventName: "product.created",
data: { id: product.id }
opts: { attempts: 5 }
},
{
eventName: "product.created",
data: { id: product2.id }
opts: { attempts: 3 }
}
]
await eventBusService.emit(events)