use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ChangePrimaryGatewayRequest in project cloudbreak by hortonworks.
the class ChangePrimaryGatewayActions method repairGatewayAction.
@Bean(name = "CHANGE_PRIMARY_GATEWAY_STATE")
public Action<?, ?> repairGatewayAction() {
return new AbstractClusterAction<ChangePrimaryGatewayTriggerEvent>(ChangePrimaryGatewayTriggerEvent.class) {
@Override
protected void doExecute(ClusterViewContext context, ChangePrimaryGatewayTriggerEvent payload, Map<Object, Object> variables) {
changePrimaryGatewayService.changePrimaryGatewayStarted(context.getStackId());
Selectable request = new ChangePrimaryGatewayRequest(context.getStackId());
sendEvent(context.getFlowId(), request.selector(), request);
}
};
}
use of com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ChangePrimaryGatewayRequest in project cloudbreak by hortonworks.
the class ChangePrimaryGatewayHandler method accept.
@Override
public void accept(Event<ChangePrimaryGatewayRequest> event) {
ChangePrimaryGatewayRequest request = event.getData();
Selectable response;
try {
response = new ChangePrimaryGatewaySuccess(request.getStackId(), clusterServiceRunner.changePrimaryGateway(request.getStackId()));
} catch (Exception e) {
response = new ChangePrimaryGatewayFailed(request.getStackId(), e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Aggregations