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

import javax.ejb.EJB;
import javax.enterprise.event.Observes;
import javax.enterprise.event.Reception;
import javax.enterprise.event.TransactionPhase;

import de.ivu.elect.business.internet.entity.PraesentationGenerierenEvent;

public class PraesentationGenerierenEventListener {

  // wichtig, da mit @Inject die asynchrone Ausführung nicht funktioniert

  @EJB
  PresentationGenerierenInternetBackgroundService presentationGenerierenInternetBackgroundService;

  public void listen(
      @Observes(during = TransactionPhase.AFTER_SUCCESS, notifyObserver = Reception.ALWAYS) PraesentationGenerierenEvent event) {
    PresentationGenerierenInternetBackgroundService.startIfNotRunning(presentationGenerierenInternetBackgroundService, PresentationGenerierenInternetBackgroundService.RUNNING);
  }
}
