本文整理汇总了Java中reactor.bus.Event.getData方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getData方法的具体用法?Java Event.getData怎么用?Java Event.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reactor.bus.Event
的用法示例。
在下文中一共展示了Event.getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<GetPlatformCloudGatewaysRequest> getPlatformCloudGatewaysRequest) {
LOGGER.info("Received event: {}", getPlatformCloudGatewaysRequest);
GetPlatformCloudGatewaysRequest request = getPlatformCloudGatewaysRequest.getData();
try {
CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(
Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()),
Variant.variant(request.getVariant()));
CloudGateWays cloudGateWays = cloudPlatformConnectors.get(cloudPlatformVariant)
.platformResources().gateways(request.getCloudCredential(), Region.region(request.getRegion()), request.getFilters());
GetPlatformCloudGatewaysResult getPlatformCloudGatewaysResult = new GetPlatformCloudGatewaysResult(request, cloudGateWays);
request.getResult().onNext(getPlatformCloudGatewaysResult);
LOGGER.info("Query platform gateway types finished.");
} catch (Exception e) {
request.getResult().onNext(new GetPlatformCloudGatewaysResult(e.getMessage(), e, request));
}
}
示例2: matches
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public boolean matches(Object argument) {
Event event = (Event) argument;
UnhealthyInstancesDetectionResult payload = (UnhealthyInstancesDetectionResult) event.getData();
Set<String> unhealthyInstanceIds = payload.getUnhealthyInstanceIds();
if (unhealthyInstanceIds.size() != expectedUnhealthyIds.size()) {
errorMessage = String.format("Sizes don't match, expected=%d, actual=%d",
expectedUnhealthyIds.size(), unhealthyInstanceIds.size());
return false;
}
for (String i : expectedUnhealthyIds) {
if (!unhealthyInstanceIds.contains(i)) {
errorMessage = String.format("Expected unhealthy instance id %s not found in actual instances %s",
i, unhealthyInstanceIds);
return false;
}
}
return true;
}
示例3: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<GetPlatformOrchestratorsRequest> getPlatformOrchestratorsRequest) {
LOGGER.info("Received event: {}", getPlatformOrchestratorsRequest);
GetPlatformOrchestratorsRequest request = getPlatformOrchestratorsRequest.getData();
try {
Map<Platform, Collection<Orchestrator>> platformCollectionHashMap = Maps.newHashMap();
Map<Platform, Orchestrator> defaults = Maps.newHashMap();
for (Entry<Platform, Collection<Variant>> connector : cloudPlatformConnectors.getPlatformVariants().getPlatformToVariants().entrySet()) {
PlatformOrchestrator platformOrchestrator = cloudPlatformConnectors.getDefault(connector.getKey()).parameters().orchestratorParams();
platformCollectionHashMap.put(connector.getKey(), platformOrchestrator.types());
defaults.put(connector.getKey(), platformOrchestrator.defaultType());
}
GetPlatformOrchestratorsResult getPlatformOrchestratorsResult = new GetPlatformOrchestratorsResult(request,
new PlatformOrchestrators(platformCollectionHashMap, defaults));
request.getResult().onNext(getPlatformOrchestratorsResult);
LOGGER.info("Query platform orchestrators types finished.");
} catch (RuntimeException e) {
request.getResult().onNext(new GetPlatformOrchestratorsResult(e.getMessage(), e, request));
}
}
示例4: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<ValidationRequest> event) {
LOGGER.info("Received event: {}", event);
ValidationRequest request = event.getData();
CloudContext cloudContext = request.getCloudContext();
ValidationResult result;
try {
CloudConnector connector = cloudPlatformConnectors.get(cloudContext.getPlatformVariant());
AuthenticatedContext ac = connector.authentication().authenticate(request.getCloudContext(), request.getCloudCredential());
CloudStack cloudStack = request.getCloudStack();
for (Validator v : connector.validators()) {
v.validate(ac, cloudStack);
}
result = new ValidationResult(request);
} catch (RuntimeException e) {
result = new ValidationResult(e, request);
}
request.getResult().onNext(result);
eventBus.notify(result.selector(), new Event(event.getHeaders(), result));
}
示例5: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<GetPlatformCloudAccessConfigsRequest> getPlatformCloudAccessConfigsRequest) {
LOGGER.info("Received event: {}", getPlatformCloudAccessConfigsRequest);
GetPlatformCloudAccessConfigsRequest request = getPlatformCloudAccessConfigsRequest.getData();
try {
CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(
Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()),
Variant.variant(request.getVariant()));
CloudAccessConfigs cloudAccessConfigs = cloudPlatformConnectors.get(cloudPlatformVariant)
.platformResources().accessConfigs(request.getCloudCredential(), Region.region(request.getRegion()), request.getFilters());
GetPlatformCloudAccessConfigsResult getPlatformCloudAccessConfigsResult = new GetPlatformCloudAccessConfigsResult(request, cloudAccessConfigs);
request.getResult().onNext(getPlatformCloudAccessConfigsResult);
LOGGER.info("Query platform access configs finished.");
} catch (Exception e) {
request.getResult().onNext(new GetPlatformCloudAccessConfigsResult(e.getMessage(), e, request));
}
}
示例6: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<GetPlatformCloudIpPoolsRequest> getPlatformIpPoolsRequest) {
LOGGER.info("Received event: {}", getPlatformIpPoolsRequest);
GetPlatformCloudIpPoolsRequest request = getPlatformIpPoolsRequest.getData();
try {
CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(
Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()),
Variant.variant(request.getVariant()));
CloudIpPools cloudIpPools = cloudPlatformConnectors.get(cloudPlatformVariant)
.platformResources().publicIpPool(request.getCloudCredential(), Region.region(request.getRegion()), request.getFilters());
GetPlatformCloudIpPoolsResult getPlatformIpPoolsResult = new GetPlatformCloudIpPoolsResult(request, cloudIpPools);
request.getResult().onNext(getPlatformIpPoolsResult);
LOGGER.info("Query platform ip pool types finished.");
} catch (Exception e) {
request.getResult().onNext(new GetPlatformCloudIpPoolsResult(e.getMessage(), e, request));
}
}
示例7: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<GetInstancesStateRequest> event) {
LOGGER.info("Received event: {}", event);
GetInstancesStateRequest request = event.getData();
CloudContext cloudContext = request.getCloudContext();
GetInstancesStateResult result;
try {
List<CloudVmInstanceStatus> instanceStatuses =
instanceStateQuery.getCloudVmInstanceStatuses(
request.getCloudCredential(), cloudContext, request.getInstances());
result = new GetInstancesStateResult(request, instanceStatuses);
} catch (RuntimeException e) {
result = new GetInstancesStateResult("Instance state synchronizing failed", e, request);
}
request.getResult().onNext(result);
eventBus.notify(result.selector(), new Event(event.getHeaders(), result));
}
示例8: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<ResourceDefinitionRequest> getRegionsRequestEvent) {
LOGGER.info("Received event: {}", getRegionsRequestEvent);
ResourceDefinitionRequest request = getRegionsRequestEvent.getData();
try {
CloudConnector connector = cloudPlatformConnectors.get(request.getPlatform());
String resource = request.getResource();
String definition = connector.parameters().resourceDefinition(request.getResource());
if (definition == null) {
Exception exception = new Exception("Failed to find resource definition for " + resource);
request.getResult().onNext(new ResourceDefinitionResult(exception.getMessage(), exception, request));
} else {
request.getResult().onNext(new ResourceDefinitionResult(request, definition));
}
} catch (RuntimeException e) {
request.getResult().onNext(new ResourceDefinitionResult(e.getMessage(), e, request));
}
}
示例9: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<ClusterSyncRequest> event) {
ClusterSyncRequest request = event.getData();
ClusterSyncResult result;
try {
Stack stack = stackService.getByIdWithLists(request.getStackId());
String proxyIp = stackUtil.extractAmbariIp(stack);
String contextPath = stack.getCluster().getGateway().getPath();
proxyRegistrator.register(stack.getName(), contextPath, proxyIp);
Cluster cluster = clusterService.retrieveClusterByStackId(request.getStackId());
ambariClusterStatusUpdater.updateClusterStatus(stack, cluster);
result = new ClusterSyncResult(request);
} catch (Exception e) {
result = new ClusterSyncResult(e.getMessage(), e, request);
}
eventBus.notify(result.selector(), new Event(event.getHeaders(), result));
}
示例10: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<DecommissionRequest> event) {
DecommissionRequest request = event.getData();
DecommissionResult result;
try {
Stack stack = stackService.getByIdWithLists(request.getStackId());
Map<String, HostMetadata> hostsToRemove = ambariDecommissioner.collectHostsToRemove(stack, request.getHostGroupName(), request.getHostNames());
Set<String> hostNames;
if (!hostsToRemove.isEmpty()) {
executePreTerminationRecipes(stack, request.getHostGroupName(), hostsToRemove.keySet());
hostNames = ambariDecommissioner.decommissionAmbariNodes(stack, hostsToRemove);
} else {
hostNames = request.getHostNames();
}
result = new DecommissionResult(request, hostNames);
} catch (Exception e) {
result = new DecommissionResult(e.getMessage(), e, request);
}
eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
示例11: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<Mensa> event) {
Mensa mensa = event.getData();
log.info("Starting update of mensa {} ({})", mensa.getName(), mensa.getId());
List<Dish> dishes = scraper.scrape(mensa.getThisWeekUrl(), mensa.getId());
dishes.addAll(scraper.scrape(mensa.getNextWeekUrl(), mensa.getId()));
if (config.isMensaOpenOnSaturday(mensa)) {
dishes.addAll(scrapeSaturdayDishes(mensa));
}
log.info("Found total of {} dishes for mensa {} ({})", dishes.size(), mensa.getName(), mensa.getId());
Map<LocalDate,List<Dish>> mapByDay = getMapByDay(dishes);
mapByDay.entrySet().forEach(entry -> startDayUpdate(mensa.getId(), entry.getKey(), entry.getValue()));
}
示例12: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
@Transactional
public void accept(Event<DayUpdate> event) {
DayUpdate update = event.getData();
log.info("Starting update for day {} and mensa {}", update.getDay().format(DateTimeFormatter.ISO_DATE), update.getMensaId());
List<Dish> oldDishes = repo.findByDateAndMensaId(update.getDay(), update.getMensaId());
repo.delete(oldDishes);
repo.save(update.getDishes());
log.info("Finished update for day {} and mensa {}. New: {}, Old: {}", update.getDay().format(DateTimeFormatter.ISO_DATE), update.getMensaId(), update.getDishes().size(), oldDishes.size());
}
示例13: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<GetSSHFingerprintsRequest> getSSHFingerprintsRequestEvent) {
LOGGER.info("Received event: {}", getSSHFingerprintsRequestEvent);
GetSSHFingerprintsRequest fingerprintsRequest = getSSHFingerprintsRequestEvent.getData();
try {
CloudContext cloudContext = fingerprintsRequest.getCloudContext();
CloudInstance cloudInstance = fingerprintsRequest.getCloudInstance();
CloudConnector connector = cloudPlatformConnectors.get(cloudContext.getPlatformVariant());
AuthenticatedContext ac = connector.authentication().authenticate(cloudContext, fingerprintsRequest.getCloudCredential());
GetSSHFingerprintsResult fingerprintsResult;
try {
String initialConsoleOutput = connector.instances().getConsoleOutput(ac, cloudInstance);
InstanceConsoleOutputResult consoleOutputResult = new InstanceConsoleOutputResult(cloudContext, cloudInstance, initialConsoleOutput);
PollTask<InstanceConsoleOutputResult> outputPollerTask = statusCheckFactory.newPollConsoleOutputTask(connector.instances(), ac, cloudInstance);
if (!outputPollerTask.completed(consoleOutputResult)) {
consoleOutputResult = syncPollingScheduler.schedule(outputPollerTask);
}
Set<String> sshFingerprints = FingerprintParserUtil.parseFingerprints(consoleOutputResult.getConsoleOutput());
if (sshFingerprints.isEmpty()) {
throw new RuntimeException("Failed to get SSH fingerprints from the specified VM instance.");
} else {
fingerprintsResult = new GetSSHFingerprintsResult(fingerprintsRequest, sshFingerprints);
}
} catch (CloudOperationNotSupportedException ignored) {
fingerprintsResult = new GetSSHFingerprintsResult(fingerprintsRequest, new HashSet<>());
}
fingerprintsRequest.getResult().onNext(fingerprintsResult);
eventBus.notify(fingerprintsResult.selector(), new Event(getSSHFingerprintsRequestEvent.getHeaders(), fingerprintsResult));
LOGGER.info("GetSSHFingerprintsHandler finished");
} catch (Exception e) {
GetSSHFingerprintsResult failure = new GetSSHFingerprintsResult("Failed to get ssh fingerprints!", e, fingerprintsRequest);
fingerprintsRequest.getResult().onNext(failure);
eventBus.notify(failure.selector(), new Event(getSSHFingerprintsRequestEvent.getHeaders(), failure));
}
}
示例14: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<BootstrapMachinesRequest> event) {
BootstrapMachinesRequest request = event.getData();
Selectable response;
try {
clusterBootstrapper.bootstrapMachines(request.getStackId());
response = new BootstrapMachinesSuccess(request.getStackId());
} catch (Exception e) {
response = new BootstrapMachinesFailed(request.getStackId(), e);
}
eventBus.notify(response.selector(), new Event(event.getHeaders(), response));
}
示例15: accept
import reactor.bus.Event; //导入方法依赖的package包/类
@Override
public void accept(Event<ClusterTerminationRequest> event) {
ClusterTerminationRequest request = event.getData();
ClusterTerminationResult result;
try {
Boolean allowed = clusterTerminationService.deleteClusterComponents(request.getClusterId());
result = new ClusterTerminationResult(request, allowed);
} catch (RuntimeException e) {
LOGGER.error("Failed to delete cluster containers", e);
result = new ClusterTerminationResult(e.getMessage(), e, request);
}
eventBus.notify(result.selector(), new Event(event.getHeaders(), result));
}