views:

46

answers:

1

Is there any way a database change (say an insert statement) can trigger a call to a ruby method in my app? I know about observers but this is sort of a complicated situation, because the database is updated by a Java application.

Note, both the Rails and the Java app connect to the same database.

+2  A: 
  1. Polling DB by Rails app - in regular time intervals.
  2. Introduce table trigger which runs pl/ruby, pl/* or whatever to ping command-line, REST or web service of Rails app.
  3. Java app 'pings' Rails app (via REST, SOAP etc) after DB change.

In case 2&3 ping event can contain some more information - e.g. row id.

gertas