Search in sources :

Example 1 with EphemeralClusterUpdateRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateRequest in project cloudbreak by hortonworks.

the class EphemeralClusterUpdateHandler method accept.

@Override
public void accept(Event<EphemeralClusterUpdateRequest> event) {
    EphemeralClusterUpdateRequest request = event.getData();
    Selectable response;
    try {
        clusterServiceRunner.updateSaltState(request.getStackId());
        response = new EphemeralClusterUpdateSuccess(request.getStackId());
    } catch (Exception e) {
        response = new EphemeralClusterUpdateFailed(request.getStackId(), e);
    }
    eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Also used : EphemeralClusterUpdateRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateRequest) EphemeralClusterUpdateSuccess(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateSuccess) Selectable(com.sequenceiq.cloudbreak.cloud.event.Selectable) EphemeralClusterUpdateFailed(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateFailed)

Example 2 with EphemeralClusterUpdateRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateRequest in project cloudbreak by hortonworks.

the class EphemeralClusterActions method updateNameserverAction.

@Bean(name = "EPHEMERAL_CLUSTER_UPDATE_STATE")
public Action<?, ?> updateNameserverAction() {
    return new AbstractClusterAction<EphemeralClusterUpdateTriggerEvent>(EphemeralClusterUpdateTriggerEvent.class) {

        @Override
        protected void doExecute(ClusterViewContext context, EphemeralClusterUpdateTriggerEvent payload, Map<Object, Object> variables) {
            ephemeralClusterService.updateClusterStarted(context.getStackId());
            Selectable request = new EphemeralClusterUpdateRequest(context.getStackId());
            sendEvent(context.getFlowId(), request.selector(), request);
        }
    };
}
Also used : EphemeralClusterUpdateRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateRequest) Selectable(com.sequenceiq.cloudbreak.cloud.event.Selectable) EphemeralClusterUpdateTriggerEvent(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateTriggerEvent) AbstractClusterAction(com.sequenceiq.cloudbreak.core.flow2.cluster.AbstractClusterAction) Map(java.util.Map) ClusterViewContext(com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext) Bean(org.springframework.context.annotation.Bean)

Aggregations

Selectable (com.sequenceiq.cloudbreak.cloud.event.Selectable)2 EphemeralClusterUpdateRequest (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateRequest)2 AbstractClusterAction (com.sequenceiq.cloudbreak.core.flow2.cluster.AbstractClusterAction)1 ClusterViewContext (com.sequenceiq.cloudbreak.core.flow2.cluster.ClusterViewContext)1 EphemeralClusterUpdateFailed (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateFailed)1 EphemeralClusterUpdateSuccess (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateSuccess)1 EphemeralClusterUpdateTriggerEvent (com.sequenceiq.cloudbreak.reactor.api.event.orchestration.EphemeralClusterUpdateTriggerEvent)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1