Skip to content

Commit

Permalink
fetch latest resource from DB
Browse files Browse the repository at this point in the history
  • Loading branch information
pkjacob committed Jan 14, 2025
1 parent ff9d7bd commit 6bb84f6
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ public void afterUpdate(ResourceUpdatedEvent resourceUpdatedEvent) {
@TransactionalEventListener
public void afterReplace(ResourceReplacedEvent resourceReplacedEvent) {
log.info("ResourceReplacedEvent received [{}]", resourceReplacedEvent);
replaceMessageSenders.forEach(
sender -> sender.produce(resourceReplacedEvent.previous(), resourceReplacedEvent.current())
);
resourceRepository.findById(resourceReplacedEvent.current().getId())
.ifPresent(resource -> replaceMessageSenders.forEach(
sender -> sender.produce(resourceReplacedEvent.previous(), resource)
)
);
}

@TransactionalEventListener
Expand Down

0 comments on commit 6bb84f6

Please sign in to comment.