Postgresql - change detection and webservice call

I have a PostgreSQL database. I want to do this, detect any changes (insert, update) that occur in the database, and then call the web service. How can i do this?

Thanks in advance for your help.

+11
postgresql
Mar 19 '13 at 16:36
source share
2 answers

You can use triggers and the listen / notification function in PostgreSQL to achieve something like this:

  • The insert / update / delete trigger set fires a notification event whenever something changes in your table using the created / modified / deleted ID as a payload.

  • The background process periodically checks for notifications ( using Java / JDBC for example ), and then downloads the modified record from the database to make an Internet service call.

This is by no means a real-time push type system, but you must poll the notification database to call the webservice call. However, this will do the trick.

+8
Mar 19 '13 at 16:51
source share
+7
Jan 16 '14 at 16:20
source share



All Articles