Possible use cases -
- The cached value of some lengthy calculation has been cleared. The response is to perform the calculation and put the new value in cache.
- A new customer signed up on your web site. The response is to send her an email.
- Stock of a product fell below a threshold. The response is to transmit a purchase order to the supplier.
Example
pgear --verbose --connect="inventory" --run="reorder-understocked" lowstocktells pgear to connect to the inventory database and listen for the lowstock event. In response, pgear runs the command reorder-understocked.
The value of the --connect option is the name of a service in the PostgreSQL connection service file, avoiding the plethora of connection options that would otherwise be required.
For a closer look
An html-ized man page is here.pgear is written in C and built with the GNU autotools. The license is GPLv3+.
You're welcome to take a closer look by following either or both of these links:
| pgear-0.2.tar.gz | Download this to take a look at the source and try out a build in your environment. You'll need a C compiler and the PostgreSQL libpq library and header files installed, but you don't need the autotools. |
|---|---|
| pgear source | The 'pristine' source code; to use it you'll need git and the usual build tools plus autoconf and automake installed on your computer. |
I've built and tested pgear on Debian 'squeeze' (i386 and amd64, PostgreSQL 8.4) and on OpenBSD 4.8 (i386, PostgreSQL 9.0). Your comments are welcome at webmaster@acrasis.net.