-
I'm trying to model a workflow where an event triggers a command with attributes depending on the current workflow state. Basically, the Workflow represents the Automation pattern in Event Modeling. I went through the existing examples, but still can't figure out how to do that, as I need to react on an event, but stateless Saga is not suitable for this use case. I feel an Aggregate is what I really need, but I'm not sure how to model it properly. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
Hi @kobasad, FModel is not promoting ProcessManagers ("Stateful Saga"). We had it a long time ago in FModel, but we removed it:
If you can share more about your specific case, I will be glad to elaborate. I am not sure how and if |
Beta Was this translation helpful? Give feedback.
-
/**
* Event Modeling - Translation pattern
*
* @param C Command of my system
* @param AR Action Result / Event of other system
*/
data class Translation<AR, C> (
val react: (AR) -> Sequence<C>,
)
/**
* Event Modeling - Automation pattern
*
* @param E Event of my system
* @param S State of my system
* @param A Action / Command of other system
* @param AR Action Result / Event of other system
*/
data class Automation<E, S, A, AR>(
val evolve: (S, E) -> S,
val ack: (S, AR) -> S,
val pending: (S) -> Sequence<A>,
val initialState: S,
)
|
Beta Was this translation helpful? Give feedback.
OK.
This
workflow progress
is a View. So, in Fmodel you could create a Materialized View for it.The gear at the top is your custom implementation that can pull this View/Database with some frequency and go through the ToDo List check what is currently pending and publish commands based on the state. Potentially you could make this reactive and eliminate the pooling. However, this gear is not encoded as a formal component in FModel.
How could we encode this in FModel: