@Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        JobDataMap jobData = context.getJobDetail().getJobDataMap();
        boolean isDebug = jobData.getBoolean("isDebug");
        ConcurrentLinkedDeque<String> msgQueue = (ConcurrentLinkedDeque<String>) jobData.get("msgQueue");

        LightController lightController = (isDebug)
                                                ? DummyLightController.getLightControllerInstance()
                                                : RasppiLightController.getLightControllerInstance();

        String lastBuildEvent;
        do {
            lastBuildEvent = msgQueue.pop();
        }
        while(!msgQueue.isEmpty());

        if (lastBuildEvent != null){
            // 2. When you have found tha lst message, use it to control the light.
            System.out.println("Last build event is: " + lastBuildEvent);
            switch (BuildStatus.getBuildStatus(lastBuildEvent)) {
                case ABORTED_BUILDING:
                    lightController.startBlinking();
                    break;
                case BLUE_BUILDING:
                    lightController.startBlinking();
                    break;
                case RED_BUILDING:
                    lightController.startBlinking();
                    break;
                case STABLE:
                    System.out.println("Build is Stable");
                    lightController.stopBlinking();
                    lightController.switchOnGreen();
                    break;
                case BROKEN:
                    lightController.stopBlinking();
                    lightController.switchOnRed();
                    break;
                case ABORTED:
                    lightController.stopBlinking();
                    lightController.switchOnRed();
                    break;
            }
        }
    }