How to make a database listener with java?

This is what LISTEN/NOTIFY was created for.

The only drawback is that you will need to have some kind of background thread that polls the database on a regular basis to see if any notifications are available.

You can also use the code from the Postgres Wiki to have a starting point

Leave a Comment