Search in sources :

Example 1 with SdxCertRotationWaitEvent

use of com.sequenceiq.datalake.flow.cert.rotation.event.SdxCertRotationWaitEvent in project cloudbreak by hortonworks.

the class CertRotationActions method certRotationInProgressAction.

@Bean(name = "CERT_ROTATION_IN_PROGRESS_STATE")
public Action<?, ?> certRotationInProgressAction() {
    return new AbstractSdxAction<>(SdxEvent.class) {

        @Override
        protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxEvent payload) {
            return SdxContext.from(flowParameters, payload);
        }

        @Override
        protected void doExecute(SdxContext context, SdxEvent payload, Map<Object, Object> variables) {
            LOGGER.info("Cert rotation is in progress. Start waiting to finish");
            SdxCertRotationWaitEvent event = new SdxCertRotationWaitEvent(context);
            sendEvent(context, event);
        }

        @Override
        protected Object getFailurePayload(SdxEvent payload, Optional<SdxContext> flowContext, Exception ex) {
            return new SdxCertRotationFailedEvent(payload, ex);
        }
    };
}
Also used : SdxCertRotationFailedEvent(com.sequenceiq.datalake.flow.cert.rotation.event.SdxCertRotationFailedEvent) FlowParameters(com.sequenceiq.flow.core.FlowParameters) AbstractSdxAction(com.sequenceiq.datalake.service.AbstractSdxAction) Optional(java.util.Optional) StateContext(org.springframework.statemachine.StateContext) SdxCertRotationWaitEvent(com.sequenceiq.datalake.flow.cert.rotation.event.SdxCertRotationWaitEvent) SdxEvent(com.sequenceiq.datalake.flow.SdxEvent) Map(java.util.Map) SdxContext(com.sequenceiq.datalake.flow.SdxContext) Bean(org.springframework.context.annotation.Bean)

Aggregations

SdxContext (com.sequenceiq.datalake.flow.SdxContext)1 SdxEvent (com.sequenceiq.datalake.flow.SdxEvent)1 SdxCertRotationFailedEvent (com.sequenceiq.datalake.flow.cert.rotation.event.SdxCertRotationFailedEvent)1 SdxCertRotationWaitEvent (com.sequenceiq.datalake.flow.cert.rotation.event.SdxCertRotationWaitEvent)1 AbstractSdxAction (com.sequenceiq.datalake.service.AbstractSdxAction)1 FlowParameters (com.sequenceiq.flow.core.FlowParameters)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Bean (org.springframework.context.annotation.Bean)1 StateContext (org.springframework.statemachine.StateContext)1