Search in sources :

Example 6 with EnvStopEvent

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);
        }
    };
}
Also used : EnvironmentStatus(com.sequenceiq.environment.environment.EnvironmentStatus) EnvStopEvent(com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CommonContext(com.sequenceiq.flow.core.CommonContext) ResourceEvent(com.sequenceiq.cloudbreak.event.ResourceEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 7 with EnvStopEvent

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)));
}
Also used : EnvStopEvent(com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent) EnvStackConfigUpdatesEvent(com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent) EnvCreationEvent(com.sequenceiq.environment.environment.flow.creation.event.EnvCreationEvent) Event(reactor.bus.Event) EnvStopEvent(com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent) EnvStartEvent(com.sequenceiq.environment.environment.flow.start.event.EnvStartEvent) LoadBalancerUpdateEvent(com.sequenceiq.environment.environment.flow.loadbalancer.event.LoadBalancerUpdateEvent) UpgradeCcmEvent(com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent) EnvDeleteEvent(com.sequenceiq.environment.environment.flow.deletion.event.EnvDeleteEvent)

Aggregations

EnvStopEvent (com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent)7 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)6 ResourceEvent (com.sequenceiq.cloudbreak.event.ResourceEvent)3 EnvironmentStatus (com.sequenceiq.environment.environment.EnvironmentStatus)3 EnvStopFailedEvent (com.sequenceiq.environment.environment.flow.stop.event.EnvStopFailedEvent)3 CommonContext (com.sequenceiq.flow.core.CommonContext)3 Map (java.util.Map)3 Bean (org.springframework.context.annotation.Bean)3 EnvStackConfigUpdatesEvent (com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent)1 EnvCreationEvent (com.sequenceiq.environment.environment.flow.creation.event.EnvCreationEvent)1 EnvDeleteEvent (com.sequenceiq.environment.environment.flow.deletion.event.EnvDeleteEvent)1 LoadBalancerUpdateEvent (com.sequenceiq.environment.environment.flow.loadbalancer.event.LoadBalancerUpdateEvent)1 EnvStartEvent (com.sequenceiq.environment.environment.flow.start.event.EnvStartEvent)1 UpgradeCcmEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent)1 FreeIpaOperationFailedException (com.sequenceiq.environment.exception.FreeIpaOperationFailedException)1 Event (reactor.bus.Event)1