use of io.gravitee.am.common.event.ReporterEvent in project gravitee-access-management by gravitee-io.
the class AuditReporterManagerImpl method updateReporter.
private void updateReporter(String reporterId, ReporterEvent reporterEvent) {
final String eventType = reporterEvent.toString().toLowerCase();
logger.info("Domain {} has received {} reporter event for {}", domain.getName(), eventType, reporterId);
reporterRepository.findById(reporterId).flatMapSingle(reporter -> environmentService.findById(domain.getReferenceId()).map(env -> new GraviteeContext(env.getOrganizationId(), env.getId(), domain.getId())).map(ctx -> Tuples.of(reporter, ctx))).subscribeOn(Schedulers.io()).subscribe(tupleReporterContext -> {
updateReporterProvider(tupleReporterContext.getT1(), tupleReporterContext.getT2());
logger.info("Reporter {} {}d for domain {}", reporterId, eventType, domain.getName());
}, error -> logger.error("Unable to {} reporter for domain {}", eventType, domain.getName(), error));
}
use of io.gravitee.am.common.event.ReporterEvent in project gravitee-access-management by gravitee-io.
the class AuditReporterManagerImpl method deployReporter.
private void deployReporter(String reporterId, ReporterEvent reporterEvent) {
final String eventType = reporterEvent.toString().toLowerCase();
logger.info("Domain {} has received {} reporter event for {}", domain.getName(), eventType, reporterId);
reporterRepository.findById(reporterId).flatMapSingle(reporter -> environmentService.findById(domain.getReferenceId()).map(env -> new GraviteeContext(env.getOrganizationId(), env.getId(), domain.getId())).map(ctx -> Tuples.of(reporter, ctx))).subscribeOn(Schedulers.io()).subscribe(tupleReporterContext -> {
if (reporters.containsKey(reporterId)) {
updateReporterProvider(tupleReporterContext.getT1(), tupleReporterContext.getT2());
} else {
startReporterProvider(tupleReporterContext.getT1(), tupleReporterContext.getT2());
}
logger.info("Reporter {} {}d for domain {}", reporterId, eventType, domain.getName());
}, error -> logger.error("Unable to {} reporter for domain {}", eventType, domain.getName(), error));
}
Aggregations