use of com.mercedesbenz.sechub.sharedkernel.messaging.MappingMessage in project sechub by mercedes-benz.
the class UpdateMappingService method sendEvent.
@IsSendingAsyncMessage(MessageID.MAPPING_CONFIGURATION_CHANGED)
private void sendEvent(Mapping mapping) {
MappingMessage mappingMessage = new MappingMessage();
mappingMessage.setMappingId(mapping.getId());
mappingMessage.setMappingData(MappingData.fromString(mapping.getData()));
DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.MAPPING_CONFIGURATION_CHANGED);
request.set(MessageDataKeys.CONFIG_MAPPING_DATA, mappingMessage);
eventBus.sendAsynchron(request);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.MappingMessage in project sechub by mercedes-benz.
the class ScanMessageHandler method handleMappingConfigurationChanged.
@IsReceivingAsyncMessage(MessageID.MAPPING_CONFIGURATION_CHANGED)
@UseCaseAdmiUpdatesMappingConfiguration(@Step(number = 3, name = "Event handler", description = "Receives mapping configuration change event"))
private void handleMappingConfigurationChanged(DomainMessage request) {
MappingMessage data = request.get(MessageDataKeys.CONFIG_MAPPING_DATA);
String mappingId = data.getMappingId();
MappingIdentifier found = MappingIdentifier.getIdentifierOrNull(mappingId);
if (found == null) {
LOG.error("Mapping identifier with id:{} does not exist!", mappingId);
return;
}
/* filter only relevant parts - message may contain uninteresting stuff */
if (!found.hasTypeContainedIn(MappingType.ADAPTER_CONFIGURATION, MappingType.COMMON_CONFIGURATION)) {
LOG.debug("Mapping with id:{} is not relevant for cluster configuration and so ignored.", mappingId);
return;
}
updateScanMappingService.updateScanMapping(mappingId, data.getMappingData());
}
Aggregations