Skip to content

Instantly share code, notes, and snippets.

@sohlich
Created May 28, 2018 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sohlich/980e3740f4b8bbff851bb20a93e62731 to your computer and use it in GitHub Desktop.
Save sohlich/980e3740f4b8bbff851bb20a93e62731 to your computer and use it in GitHub Desktop.
spring - hook on transaction commit
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter(){
public void afterCommit(){
List<Ontology> markets = ontologyRepository.findAll(dtoList
.stream()
.map(MarketDTO::getMarketId)
.collect(Collectors.toList()));
log.info("Indexing markets after deferral configuration: {}",markets.size());
ontologyIndexRepository.indexList(markets);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment