Type Alias SaveWithEventCallback

SaveWithEventCallback: ((session: ClientSession, db: Db, client: MongoClient) => Promise<void>)

A callback fired with a new session where additional persistance can be done along with the event(s).

Type declaration

    • (session, db, client): Promise<void>
    • Parameters

      • session: ClientSession

        A passed (new) session.

      • db: Db

        The database passed during the {OutboxConsumer} creation.

      • client: MongoClient

        The database passed during the {OutboxConsumer} creation.

      Returns Promise<void>

      An empty promise.

await outbox.publish(event, async (session, db) => {
await db.collection('test').insertOne(
{
param: 1,
},
{ session },
)
})