pgReQ: A LISTEN/NOTIFY-based request exchange mechanism for PostgreSQL clients

pgReQ is a LISTEN/NOTIFY-based request exchange mechanism for clients connecting to a PostgreSQL server.
The name pgReQ is short for postgres Request Queue.

pgReQ is a solution for developers who need to implement inter-process communication between applications connecting to the same postgres database.

pgReQ maintains three queues:

Incoming requests the client has accepted and has to process/respond to (until they expire)
Requests the client has made to other clients and are awaiting response (until they expire)
Responses to requests the client has made to other clients (and they came back with a reply)

pgReQ does not control or enforce program flow: It only maintains the queues. The rest is up to your application.
For integrating pgReQ to your application you can either use an event-based model or poll the queues at your own convenience.
pgReQ can be used to implement both client-server and peer-to-peer communication.

There is no extensive documentation on the classes. Study the demo application.
It shows all you need to know for using the two pgReQ classes.

Hope you find it useful.
Cheers,

What is the advantage of using your classes over the XOJO implication? The XOJO implication is ‘tried and trusted’, so there would need to be a very good reason for me to switch.

Hello James,
If by “XOJO implication” you mean the PostgreSQLDatabase.Notify and PostgreSQLDatabase.Listen methods, then there’s no issue here: pgReQ is an abstraction layer on top of the LISTEN/NOTIFY mechanism, not its replacement. Its purpose is to add functionality that does not exist by default, not provide an alternative way of doing the same thing.

If you need a request queue (and not just a message queue), the advantage of using pgReQ is that you won’t have to make one yourself from scratch. In this case you would have to weigh the time it would take you to study the demo app, against building your own thing. As far as I’m concerned, I’ve made an effort to minimize the former.

If you just need a simple message queue and/or you’ve already implemented something similar in your application and it works well, then there’s absolutely no reason to use pgReQ.