use of com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent in project cloudbreak by hortonworks.
the class EnvStopActions method stopDatahub.
@Bean(name = "STOP_DATAHUB_STATE")
public Action<?, ?> stopDatahub() {
return new AbstractEnvStopAction<>(EnvStopEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvStopEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.STOP_DATAHUB_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_STOP_DATAHUB_STARTED;
EnvStopState envStopState = EnvStopState.STOP_DATAHUB_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, envStopState);
sendEvent(context, EnvStopHandlerSelectors.STOP_DATAHUB_HANDLER_EVENT.selector(), envDto);
}
};
}
use of com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent in project cloudbreak by hortonworks.
the class EnvironmentReactorFlowManager method triggerStopFlow.
public FlowIdentifier triggerStopFlow(long envId, String envName, String userCrn) {
LOGGER.info("Environment stop flow triggered.");
EnvStopEvent envStopEvent = EnvStopEvent.EnvStopEventBuilder.anEnvStopEvent().withAccepted(new Promise<>()).withSelector(EnvStopStateSelectors.ENV_STOP_DATAHUB_EVENT.selector()).withResourceId(envId).withResourceName(envName).build();
return eventSender.sendEvent(envStopEvent, new Event.Headers(getFlowTriggerUsercrn(userCrn)));
}
Aggregations