Search in sources :

Example 1 with SdxCertRenewalWaitEvent

use of com.sequenceiq.datalake.flow.cert.renew.event.SdxCertRenewalWaitEvent in project cloudbreak by hortonworks.

the class CertRenewalActions method certRenewInProgressAction.

@Bean(name = "CERT_RENEWAL_IN_PROGRESS_STATE")
public Action<?, ?> certRenewInProgressAction() {
    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) throws Exception {
            LOGGER.info("Cert renewal is in progress. Start waiting to finish.");
            sendEvent(context, new SdxCertRenewalWaitEvent(context));
        }

        @Override
        protected Object getFailurePayload(SdxEvent payload, Optional<SdxContext> flowContext, Exception ex) {
            return new SdxCertRenewalFailedEvent(payload, ex.getMessage());
        }
    };
}
Also used : FlowParameters(com.sequenceiq.flow.core.FlowParameters) AbstractSdxAction(com.sequenceiq.datalake.service.AbstractSdxAction) Optional(java.util.Optional) SdxCertRenewalWaitEvent(com.sequenceiq.datalake.flow.cert.renew.event.SdxCertRenewalWaitEvent) StateContext(org.springframework.statemachine.StateContext) SdxEvent(com.sequenceiq.datalake.flow.SdxEvent) SdxCertRenewalFailedEvent(com.sequenceiq.datalake.flow.cert.renew.event.SdxCertRenewalFailedEvent) 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 SdxCertRenewalFailedEvent (com.sequenceiq.datalake.flow.cert.renew.event.SdxCertRenewalFailedEvent)1 SdxCertRenewalWaitEvent (com.sequenceiq.datalake.flow.cert.renew.event.SdxCertRenewalWaitEvent)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