use of com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage 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);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage in project sechub by mercedes-benz.
the class AuthUserCreationService method createUser.
@UseCaseAdminAcceptsSignup(@Step(number = 4, next = { Step.NO_NEXT_STEP }, name = "Give user access", description = "Authorization layer is informed about new user and gives access to sechub. But without any project information"))
@IsSendingAsyncMessage(MessageID.REQUEST_USER_ROLE_RECALCULATION)
public void createUser(String userId, String hashedApiToken) {
assertion.assertIsValidUserId(userId);
Optional<AuthUser> found = userRepo.findByUserId(userId);
if (found.isPresent()) {
LOG.warn("Will skip user create action because user already found with name:{}", userId);
return;
}
AuthUser user = new AuthUser();
user.setUserId(userId);
userRepo.save(user);
LOG.info("Created auth user:{}", userId);
eventBus.sendAsynchron(DomainMessageFactory.createRequestRoleCalculation(userId));
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage in project sechub by mercedes-benz.
the class SchedulerCancelJobService method sendJobCanceled.
@IsSendingAsyncMessage(MessageID.JOB_CANCELED)
private void sendJobCanceled(ScheduleSecHubJob secHubJob, String ownerEmailAddress) {
DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.JOB_CANCELED);
JobMessage message = new JobMessage();
message.setJobUUID(secHubJob.getUUID());
message.setProjectId(secHubJob.getProjectId());
message.setOwner(secHubJob.getOwner());
message.setOwnerEmailAddress(ownerEmailAddress);
request.set(MessageDataKeys.JOB_CANCEL_DATA, message);
eventBus.sendAsynchron(request);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage in project sechub by mercedes-benz.
the class ScheduleJobLauncherService method sendJobStarted.
@IsSendingAsyncMessage(MessageID.JOB_STARTED)
private void sendJobStarted(String projectId, UUID jobUUID, String configuration, String owner) {
DomainMessage request = new DomainMessage(MessageID.JOB_STARTED);
JobMessage message = new JobMessage();
message.setProjectId(projectId);
message.setJobUUID(jobUUID);
message.setConfiguration(configuration);
message.setOwner(owner);
message.setSince(LocalDateTime.now());
request.set(MessageDataKeys.JOB_STARTED_DATA, message);
eventBus.sendAsynchron(request);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage in project sechub by mercedes-benz.
the class ProjectCreationService method sendProjectCreatedEvent.
@IsSendingAsyncMessage(MessageID.PROJECT_CREATED)
private void sendProjectCreatedEvent(String projectId, Set<URI> whitelist) {
DomainMessage request = new DomainMessage(MessageID.PROJECT_CREATED);
ProjectMessage message = new ProjectMessage();
message.setProjectId(projectId);
message.setWhitelist(whitelist);
request.set(MessageDataKeys.PROJECT_CREATION_DATA, message);
eventBus.sendAsynchron(request);
}
Aggregations