diff --git a/spring-cloud-skipper/spring-cloud-skipper-server-core/src/main/java/org/springframework/cloud/skipper/server/statemachine/UpgradeDeployTargetAppsSucceedAction.java b/spring-cloud-skipper/spring-cloud-skipper-server-core/src/main/java/org/springframework/cloud/skipper/server/statemachine/UpgradeDeployTargetAppsSucceedAction.java index eb55a89377..4f95b93cf0 100644 --- a/spring-cloud-skipper/spring-cloud-skipper-server-core/src/main/java/org/springframework/cloud/skipper/server/statemachine/UpgradeDeployTargetAppsSucceedAction.java +++ b/spring-cloud-skipper/spring-cloud-skipper-server-core/src/main/java/org/springframework/cloud/skipper/server/statemachine/UpgradeDeployTargetAppsSucceedAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,12 @@ */ package org.springframework.cloud.skipper.server.statemachine; +import reactor.core.publisher.Mono; + import org.springframework.cloud.skipper.server.statemachine.SkipperStateMachineService.SkipperEvents; import org.springframework.cloud.skipper.server.statemachine.SkipperStateMachineService.SkipperStates; +import org.springframework.messaging.Message; +import org.springframework.messaging.support.MessageBuilder; import org.springframework.statemachine.StateContext; import org.springframework.statemachine.action.Action; @@ -32,6 +36,10 @@ public class UpgradeDeployTargetAppsSucceedAction extends AbstractAction { protected void executeInternal(StateContext context) { // TODO: when we support other type of strategies, we would not need to just // blindly send accept as we can also cancel upgrade in this stage. - context.getStateMachine().sendEvent(SkipperEvents.UPGRADE_ACCEPT); + Message event = MessageBuilder.withPayload(SkipperEvents.UPGRADE_ACCEPT).build(); + // TODO: blindly sending event and subscribing(we can't block here) into it is not + // super nice, should look better reactive chain possibly better + // reactive support in a statemachine + context.getStateMachine().sendEvent(Mono.just(event)).subscribe(); } }