my app is developed from 2 parts – rails frontend and java backend. Backend can modify db (add, modify or remove records) and i’m looking for a solution – how to monitor changes in db from frontend to push it to the clients. Of course – i can add code to backend to call for some method via http get, but maybe you can recommend me something better?
Share
I recommend the Faye gem. Checkout http://railscasts.com/episodes/260-messaging-with-faye. You need to build a “caller” in the java app that calls a Faye function once data is processed. Then let faye push data to the clients.
Added:
Build an API controller with a action within your rails app that your JAVA app calls whenever it updates the data. The API action can then use Faye to push data to the rails “clients”.
If you implement it this way you can be very specific in your calls from the Java app and only update clients that needs to be updated. You can also add other sophistication, for instance if your data gets updated very often, you can queue updates and push them at certain configurable intevals. etc etc.