To install queues-mongo-driver add the following dependency to your Package.swift
:
.package(url: "https://github.com/mstepanov/queues-mongodb-driver.git", from: "1.0.0"),
This driver depends on MongoSwift so to configure the driver we need an instance of a MongoDatabase
. Ideally during app startup or in your configure.swift
:
import QueuesMongoDriver
import MongoSwift
func configure(app: Application) async throws {
let mongoClient = try MongoClient("mongodb://localhost:27017/", using: app.eventLoopGroup)
try await app.queues.use(.mongodb(mongoClient.db("my-database")))
}