Search in sources :

Example 1 with SchedulerMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.SchedulerMessage in project sechub by mercedes-benz.

the class SchedulerStatusService method buildStatus.

@IsSendingAsyncMessage(MessageID.SCHEDULER_STATUS_UPDATE)
public void buildStatus() {
    DomainMessage message = DomainMessageFactory.createEmptyRequest(MessageID.SCHEDULER_STATUS_UPDATE);
    SchedulerMessage sm = new SchedulerMessage();
    long amountOfJobsAll = jobRepository.count();
    long amountOfRunningJobs = jobRepository.countRunningJobs();
    long amountOfWaitingJobs = jobRepository.countWaitingJobs();
    boolean processingEnabled = configService.isJobProcessingEnabled();
    sm.setAmountOfJobsAll(amountOfJobsAll);
    sm.setAmountOfRunningJobs(amountOfRunningJobs);
    sm.setAmountOfWaitingJobs(amountOfWaitingJobs);
    sm.setJobProcessingEnabled(processingEnabled);
    message.set(MessageDataKeys.SCHEDULER_STATUS_DATA, sm);
    eventBus.sendAsynchron(message);
}
Also used : SchedulerMessage(com.mercedesbenz.sechub.sharedkernel.messaging.SchedulerMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 2 with SchedulerMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.SchedulerMessage in project sechub by mercedes-benz.

the class SchedulerAdministrationMessageHandler method handleSchedulerStatusChange.

@IsReceivingAsyncMessage(MessageID.SCHEDULER_STATUS_UPDATE)
private void handleSchedulerStatusChange(DomainMessage request) {
    SchedulerMessage status = request.get(MessageDataKeys.SCHEDULER_STATUS_DATA);
    updateSchedulerJobProcessingEnabled(status.isJobProcessingEnabled());
    updateSchedulerJobInformation(status);
}
Also used : SchedulerMessage(com.mercedesbenz.sechub.sharedkernel.messaging.SchedulerMessage) IsReceivingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsReceivingAsyncMessage)

Aggregations

SchedulerMessage (com.mercedesbenz.sechub.sharedkernel.messaging.SchedulerMessage)2 DomainMessage (com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage)1 IsReceivingAsyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsReceivingAsyncMessage)1 IsSendingAsyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)1