When you’re developing a fairly large application, and you design things properly, you will almost inevitably end up distilling out some nice things into independent, well-factored libraries – because, Separation of Concerns, you know… 🤓
With Mongrow, you can write database migrations as C# classes and have them executed in a safe, consistent, and deterministic manner, probably when your application starts up.
Its design is very much inspired by migr8, another little database migration library, only made for MSSQL and Postgres.
So… if you’re using MongoDB in .NET, you might want to check it out: The binaries are on NuGet.org.
It’s a nifty little tool with a silly label, but since it implements queues on top of MongoDB, the name was inevitable! 🤠
So, if all you have in the world is MongoDB, and you want to do some messaging, you can do this:
var config = new Config("mongodb://MONGOBONGO01/some-db", "messages");
to create a configuration, and then you
var producer = config.CreateProducer(); var message = new Message(Encoding.UTF8.GetBytes("hei")); await producer.SendAsync("destination-queue", message);
to send a UTF8-encoded text to a queue named
destination-queue, and then you
var consumer = config.CreateConsumer("destination-queue"); var message = await consumer.GetNextAsync(); // ... handle message here
to receive the message and handle it.