• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to update spring cache when using spring data repository

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Thanks.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic