Description
Describe the proposal
We should enable a smooth Workflow authoring experience for Spring Boot developers.
Tools like Spring StateMachine, Temporal and Camunda Zeebe provide Spring Boot specific annotations for workflows/statemachines.
For reference:
- https://docs.spring.io/spring-statemachine/docs/4.0.0/reference/index.html#introduction
- https://github.com/camunda-community-hub/spring-zeebe?tab=readme-ov-file#quickstart
- https://pankaj02.medium.com/workflow-orchestration-with-temporal-and-spring-boot-340e639b4b28
In this proposal, I suggest creating a Workflow authoring and execution experience tailored to Spring Boot users. This should also be aligned with other SDKs like .Net and Go.
The main difference here, is that with Spring Boot we should aim for a higher level abstractions to provide an experience that is aligned with Spring Boot concepts and ways of working, which is not at the same level as the current Workflow APIs that provide access directly to Dapr Workflow features.
I would suggest going in a similar route as Temporal Spring Boot Integration where the workflow authoring experience provides the use the possibility to define their own business interfaces (as Spring Beans) that will be used by application developers to interact with workflow functionalities. For example:
@WorkflowInterface
public interface OrderFulfillmentWorkflow {
@WorkflowMethod
void createOrder(OrderDTO orderDTO);
}
This defines a Spring Bean that has business meaning. This can be injected in any Spring boot application and it defines semantically what the workflow will be doing. Inside @WorkflowMethods
activities can be sequenced, hiding the complexity of workflow mechanisms.
WorkflowActivities can be also masked, as this way of calling an activity:
ctx.callActivity(PlaceOrderToKitchen.class.getName(), workflowPayload).await();
Is very odd for a spring boot user.
What I would like to do as a spring boot user is the following:
...
@Autowired
private WorkflowActivity placeOrderToKitchen;
@Autowired
private WorkflowActivity deliverOrderToCustomer;
...
public void placePizzaOrder(Order order){
boolean orderOk = placeOrderToKitchen.call(order, Boolean.class).wait(); // where we specify the input and output
if( orderOk ) {
DeliveryId id = deliverOrderToCustomer.call(order, DeliveryId.class).wait(5, Duration.Minutes);
// If timeout send notification to customer..
} else{
// validate order and resubmit..
}
}