diff --git a/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/service/SchedulerApiary.java b/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/service/SchedulerApiary.java index 3ad876a1..ed9a1825 100644 --- a/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/service/SchedulerApiary.java +++ b/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/service/SchedulerApiary.java @@ -22,8 +22,6 @@ import java.util.List; import java.util.Optional; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -53,7 +51,7 @@ public SchedulerApiary( @Transactional public void scheduleBeekeeperEvent() { Optional housekeepingEntitiesToBeScheduled = beekeeperEventReader.read(); - if (housekeepingEntitiesToBeScheduled.isEmpty()) {return;} + if (housekeepingEntitiesToBeScheduled.isEmpty()) { return; } BeekeeperEvent beekeeperEvent = housekeepingEntitiesToBeScheduled.get(); List housekeepingEntities = beekeeperEvent.getHousekeepingEntities(); @@ -65,13 +63,15 @@ public void scheduleBeekeeperEvent() { } catch (Exception e) { throw new BeekeeperException(format( "Unable to schedule %s deletion for entity, this message will go back on the queue", - entity.getLifecycleType()), e); + entity.getLifecycleType()), + e); } } + beekeeperEventReader.delete(beekeeperEvent); } public void close() throws IOException { beekeeperEventReader.close(); } -} +} \ No newline at end of file