I’m wondering how to make a simple swing app aware of changes in Grails app. So if Grails updates a domain object, Swing becomes aware of it and updates it’s display. Both app backed by the same DB.
I’m thinking Grails JMS (or Apache Camel) Plugin can expose changes taking place, but how does the Swing app discover them? I’d expect the implementation on Grails side would be straight forward but I’m completely lost as to the Swing side.
If it sounds vague, it’s because this type of integration is a completely uncharted territory for me at this time. So much so that I have no code to post yet.
Well, if is the same database you can create a table that will have records when something changed and some method to update this table (triggers or updates in your grails app). Your Swing app will just check (you can use timers or Quartz jobs) the table and refresh the view when found something.
Something like:
The
domainandid_recrod_domainmakes your desktop application more flexible, you can have a specific view that will refresh only for one specific domain, for example.The
timestamp_update_swingis to know if the view already has been updated and when.So the flow will be: