Is there any way a database change (say an insert statement) can trigger a call to a ruby开发者_StackOverflow 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.
- Polling DB by Rails app - in regular time intervals.
- Introduce table trigger which runs pl/ruby, pl/* or whatever to ping command-line, REST or web service of Rails app.
- 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.
精彩评论