Search in sources :

Example 1 with EnvStackConfigUpdatesEvent

use of com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent in project cloudbreak by hortonworks.

the class EnvironmentReactorFlowManager method triggerStackConfigUpdatesFlow.

public FlowIdentifier triggerStackConfigUpdatesFlow(EnvironmentView environment, String userCrn) {
    stackService.cancelRunningStackConfigUpdates(environment);
    LOGGER.info("Environment stack configurations update flow triggered.");
    EnvStackConfigUpdatesEvent envStackConfigUpdatesEvent = EnvStackConfigUpdatesEventBuilder.anEnvStackConfigUpdatesEvent().withAccepted(new Promise<>()).withSelector(EnvStackConfigUpdatesStateSelectors.ENV_STACK_CONFIG_UPDATES_START_EVENT.selector()).withResourceId(environment.getId()).withResourceName(environment.getName()).withResourceCrn(environment.getResourceCrn()).build();
    return eventSender.sendEvent(envStackConfigUpdatesEvent, new Event.Headers(getFlowTriggerUsercrn(userCrn)));
}
Also used : Promise(reactor.rx.Promise) 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) EnvStackConfigUpdatesEvent(com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent)

Example 2 with EnvStackConfigUpdatesEvent

use of com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent in project cloudbreak by hortonworks.

the class EnvStackConfigUpdatesActions method collectClusterInfo.

@Bean(name = "STACK_CONFIG_UPDATES_START_STATE")
public Action<?, ?> collectClusterInfo() {
    return new AbstractEnvStackConfigUpdatesAction<>(EnvStackConfigUpdatesEvent.class) {

        @Override
        protected void doExecute(CommonContext context, EnvStackConfigUpdatesEvent payload, Map<Object, Object> variables) {
            EnvironmentDto environmentDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, getCurrentStatus(payload.getResourceId()), ResourceEvent.ENVIRONMENT_STACK_CONFIGS_UPDATE_STARTED, EnvStackConfigUpdatesState.STACK_CONFIG_UPDATES_START_STATE);
            sendEvent(context, EnvStackConfigUpdatesHandlerSelectors.STACK_CONFIG_UPDATES_HANDLER_EVENT.selector(), environmentDto);
        }
    };
}
Also used : EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CommonContext(com.sequenceiq.flow.core.CommonContext) EnvStackConfigUpdatesEvent(com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 3 with EnvStackConfigUpdatesEvent

use of com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent in project cloudbreak by hortonworks.

the class StackConfigUpdatesHandler method accept.

@Override
public void accept(Event<EnvironmentDto> event) {
    try {
        stackPollerService.updateStackConfigurations(event.getData().getResourceId(), event.getData().getResourceCrn(), event.getHeaders().get(FlowConstants.FLOW_ID));
        EnvStackConfigUpdatesEvent envStackConfigUpdatesEvent = EnvStackConfigUpdatesEventBuilder.anEnvStackConfigUpdatesEvent().withSelector(EnvStackConfigUpdatesStateSelectors.FINISH_ENV_STACK_CONFIG_UPDATES_EVENT.selector()).withResourceId(event.getData().getResourceId()).build();
        eventSender().sendEvent(envStackConfigUpdatesEvent, event.getHeaders());
    } catch (Exception e) {
        eventSender().sendEvent(new EnvStackConfigUpdatesFailedEvent(event.getData(), e, null), event.getHeaders());
    }
}
Also used : EnvStackConfigUpdatesFailedEvent(com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesFailedEvent) EnvStackConfigUpdatesEvent(com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent)

Aggregations

EnvStackConfigUpdatesEvent (com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent)3 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)1 EnvStackConfigUpdatesFailedEvent (com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesFailedEvent)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 EnvStopEvent (com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent)1 UpgradeCcmEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent)1 CommonContext (com.sequenceiq.flow.core.CommonContext)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1 Event (reactor.bus.Event)1 Promise (reactor.rx.Promise)1