Learn how to implement listen notify functionality in the MySQL Database now!

MySQL Listen Notify functionality via the JDBC driver does not appear to be supported by either MySQL or MariaDB relational databases at this time and so engineers will have to consider alternative solutions if event-driven change notification functionality is required in their DB development effort.

One possible solution for this would be to develop code that performs the create, delete, and/or update operation and then on successful commit a message is sent to registered endpoints.

MySQL Listen Notify TOC

We could implement database change notifications using User Defined Function (UDF) but just because we can, doesn’t mean we should.

Some other potential solutions to this requirement are included below.

This article was updated on March 14, 2025.

MySQL Listen Notify via UDFs

We will not cover triggers and User-Defined Functions (UDF) as they pertain to MySQL and MariaDB to call a web service endpoint.

Brief research on database change notifications in MySQL and MariaDB suggests that triggers and UDFs can be used to accomplish this, however they come with potentially significant security and performance implications that must be considered when taking this approach.

There are projects which provide this functionality and the Cyclonecode MySQL Notification project is one of them, which we’ll briefly cover in the next section.

Cyclonecode MySQL Notification

The Cyclonecode MySQL Notification project on GitHub offers a solution for receiving notifications when insert, update, and delete operations are executed — the project description is included below.

A simple example of using a user defined function (UDF) in mysql to make real-time notifications on a table change. This project consists of a mysql plugin that setups a server socket that receives messages from a trigger connected to INSERT, UPDATE, DELETE operations on a specific table in the database. The server will then send a message to a nodejs server that in turn will bounce this notification to any connected http client over a websocket.

This project could be a good place to look if you’re considering going down this path.

Maxwell’s daemon

Maxwell’s daemon, is an active project which is available on GitHub and has 136 contributors and 3.8k stars as of 05.Sept.2023.

Maxwell’s daemon is described as follows:

This is Maxwell’s daemon, a change data capture application that reads MySQL binlogs and writes data changes as JSON to Kafka, Kinesis, and other streaming platforms.

Database change notifications sent to a streaming service could then be pushed to interested client endpoints.

Maxwell’s daemon is a different architecture than receiving notifications via JDBC but it could work very well, while removing much of the need for writing custom code in order to solve this problem.

MySQL Notification Service

The MySQL Notification Service sounds like it might fit the bill however this is not the case as this service is used for performance monitoring.

The MySQL Notification Service is also not available via the JDBC driver and instead requires implementing an interface in C++.

The MySQL Notification Service will notify the callback when threads are created and destroyed and when sessions are connected, disconnected, or a user changes.

Finally, if there’s a better solution available in MySQL and MariaDB, please leave a comment and let me know.

Alternative solutions to notify when a table changes in MySQL and MariaDB

The StackOverflow thread entitled MySQL listen notify equivalent is worth a read as it covers several solutions which are specific to MySQL and MariaDB including:

Considering the options listed above, my current opinion is that if I had to implement a MySQL listen notify solution, I’d probably start with Maxwell’s daemon — note that I’ve not yet had the opportunity to work with this project directly and I’m basing my opinion strictly from the research I’ve conducted on this subject.

There appear to be better solutions when working with Amazon Web Services (AWS), in particular if you’re using the AWS Aurora database service, see [1] and [2] below.

Short-Term CTO Services

If you’re looking to hire a Temporary Chief Technology Officer then I might be able to help you — schedule an appointment with me today and we’ll discuss your requirements in more detail.

Article Conclusion

Learn more about database change notifications — a hidden gem supported by some relational databases as well as the video on Scaling Postgres Beyond PostgreSQL PgBouncer & Postgres Pgpool-II: Advanced Traffic Management.

Finally, the COBOL Copybook Converter can help you read COBOL Copybooks into the R Project for Statistical Computing as properly structured data frames — this is an open-source data engineering project.

author avatar
ThosPFuller
I am a software engineer based in Northern Virginia (USA) and this website focuses on content engineering, web development, Technical SEO, Search Engine Optimization (SEO).

Leave a Reply