@node-ts/bus-mongodb
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@node-ts/bus-mongodb

A Mongodb based persistence for workflow storage in @node-ts/bus

🔥 View our docs at https://bus.node-ts.com 🔥

🤔 Have a question? Join the Discussion 🤔

Installation

Install all packages and their dependencies

npm install @node-ts/bus-mongodb

Configure a new Mongodb persistence and register it with Bus:

import { Bus } from '@node-ts/bus-core'
import { MongodbPersistence, MongodbConfiguration } from '@node-ts/bus-mongodb'

const configuration: MongodbConfiguration = {
  connection: 'mongodb://localhost:27017',
  databaseName: 'workflows'
}
const mongodbPersistence = new MongodbPersistence(configuration)

// Configure bus to use mongodb as a persistence
const run = async () => {
  const bus = Bus
    .configure()
    .withPersistence(mongodbPersistence)
    .build()
  await bus.initialize()
  await bus.start()
}
run.then(() => void)

Configuration Options

The Mongodb persistence has the following configuration:

  • connection (required) The mongodb connection string to use. This can be a single server, a replica set, or a mongodb+srv connection.
  • schemaName (required) The database name to create workflow collections inside.

Development

Local development can be done with the aid of docker to run the required infrastructure. To do so, run:

docker run --name bus-mongodb -p 27017:27017 -d mongo

Package Sidebar

Install

npm i @node-ts/bus-mongodb

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

35.6 kB

Total Files

26

Last publish

Collaborators

  • adenhertog