Open evaachim opened 1 year ago
Temporal can begin once one of the criteria is met.
Can check if a given user exists to verify
Can check the status to verify
Based on status / requests
Preferably, both a synchronous and an asynchronous execution will be used.
workflow --> is the criteria met? --> Yes --> which one? --> resource requested --> execute activity --> login occurs --> execute activity
--> No --> don't execute activity
func Workflow(ctx workflow.Context, resource zebra.Resource, store Zebra.Store) (string, error){
options := workflow.ActivityOptions{
// some options.
}
execute ActivityLoggedIn
executeActivityRequested
}
func ActivityRequested(ctx context.Context, store zebra.Store, email string) (string, error) { if requested{ execute RequestedActivitiesInWorkflow } }
func ActivityLoggedIn(ctx context.Context, store zebra.Store, email string) (string, error) { if userLoggedIn{ execute LoginActivitiesInWorkflow } }
Things to consider:
Worker options to consider:
EnableSessionWorker
DeadlockDetectionTimeout
ActivityOptions not necessarily needed
ClientOptions may be needed
To consider making async :
To consider including in parallel exec logic:
Will only use for async situations
For notification temporal, notification code is needed and may be divided into multiple parts.
Use temporal with wrapper functions that contain the Zebra logic.
ActivityOptions not necessarily needed
ClientOptions may be needed
Need a time parameter, to timeout
Currently using StartToCloseTimeout for the time parameter
May want to consider adding an additional verification step to distinguish between activities that get triggered, especially when an activity can be subdivided into multiple activities.
Options for including API on top of temporal
May consider including a lock/mutex to protect critical sections.
There can be an interface for all temporal-related functions.
Temporal should use abstraction
Set up black-box style logic
The abstraction can have an initial condition and an exit condition.
Other things that should exist in the abstraction:
The initial condition can be one / many. Currently, it is more granular.
If there is ONE initial condition, it could possibly be the log in. If there are more, each can work as independent conditions.
Think: How will the exit condition be determined ?
Some ideas:
Ideas to consider:
[ ] Will there be a single initiation / exit condition ?
[ ] Alternatively from above, will there be multiple such conditions ?
[ ] Will there be a single workflow with multiple subworkflows / workers?
[ ] Alternatively from above, will there be multiple workflows with connective conditions?
[ ] Will temporal run indefinitely
[ ] Alternatively from above, will temporal only start at certain times?
[ ] How will the exit condition be determined
Ideas for implementing a temporal workflow for Zebra.