package de.ivu.elect.business.system.control;

import de.ivu.elect.business.system.boundary.CacheResetSession;
import de.ivu.elect.business.system.entity.CacheResetEvent;

import javax.enterprise.event.Observes;
import javax.enterprise.event.Reception;
import javax.enterprise.event.TransactionPhase;
import javax.inject.Inject;

public class CacheResetEventListener {

  @Inject
  transient CacheResetSession cacheResetSession;

  public void listen(
      @Observes(during = TransactionPhase.AFTER_SUCCESS, notifyObserver = Reception.ALWAYS) CacheResetEvent event) {
    cacheResetSession.resetCache();
  }
}
