I am trying to implement a replicated cache in a spring managed distributed application using activemq (jms). Multiple instances of the application server should update their copy of the cache when one of them triggers a change. I am trying to implement a standalone application to mimic this.
I have a spring boot rest application that uses spring data's CrudRepository. I have enabled caching by adding the @Cacheable annotations.
How can I update this cache that is managed by spring through some custom code? There are two events when update is required
1. When the save method is called I would like to execute the jms producer code to push the java object (Person) on a jms topic. How can I add custom behavior to call the jms producer code after saving the java object in the save method?
2. Update the cache (myCache) in the jms consumer code. How can I get a handle to this cache in the spring data repository external to this interface in order to so?
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop