I am trying to listen to an event in a PostgreSQL database when a table is updated. The trigger is created in the database and I would like to have libpqxx listen to the trigger signal.
I have tried the following code:
pqxx::notification_receiver receiver(conn, "my_event");
conn.prepare("LISTEN my_event");
while (true) {
// Some sort of receiver wait
// Getting info about the channel
}
The code logic makes sense but the compiler is complaining that variable type pqxx::notification_receiver is an abstract class. How can I create a derived class to be able to subscribe to the event?