DEV Community 👩‍💻👨‍💻

Cover image for Quill NDBC Postgres: A New Async Module
Juliano Alves
Juliano Alves

Posted on • Updated on • Originally published at

Quill NDBC Postgres: A New Async Module

Quill 3.5.0 is out and this release brings an integration with the already mentioned NDBC Driver. This post is a brief summary about the new module quill-ndbc-postgres.


Quill has an asynchronous module called quill-async which provides support to MySQL and Postgres databases. This module is built on top of mauricio/postgresql-async: a Netty based, database drivers for Postgres and MySQL written in Scala. It is a great solution, and we have been using it for a while now.

But all of sudden, this issue appeared:

Wait... what?

Well, it happens. A replacement is necessary.

NDBC: Non-blocking Database Connectivity

NDBC's goal is to provide a full asynchronous approach to handle databases. It is built using Netty and Futures, a High-performance Future implementation for the JVM. Sounds's like a good replacement!

Took me some time to implement it, but a few days ago my pull request integrating NDBC got merged. Now we have an alternative to quill-async-postgres; async support via NDBC driver is available with Postgres database.

Quill + NDBC

To replace the deprecated driver just a few changes are necessary. First, add quill-ndbc-postgres to your dependencies:

libraryDependencies ++= Seq(
  "io.getquill" %% "quill-ndbc-postgres" % "3.4.11"
Enter fullscreen mode Exit fullscreen mode

The needs to change as well:

Enter fullscreen mode Exit fullscreen mode

The main difference is the first line, NDBC needs to know which data source supplier class to use, for Postgres it is io.trane.ndbc.postgres.netty4.DataSourceSupplier.

Even though NDBC is written on top of Netty, we keep the api and implementation apart. This way we can build another implementation, on top of Akka, for instance.

Now we have everything in place to start using NdbcPostgresContext:

val ctx = new NdbcPostgresContext(Literal, "ctx")
Enter fullscreen mode Exit fullscreen mode

That's all, fairly straightforward. When you start using it, let me know how it goes for you in the comments, or please open an issue at the project's github.

The next step is the MySQL implementation. I will let you know when it happens :)

Originally posted on my blog

Top comments (0)

Image description

Join the One Year Club

You can earn this badge by being a registered member of the DEV Community for at least one year. Create an account and get started today.