Open dhiaayachi opened 2 months ago
This issue requests the ability to determine if a workflow task is part of a reset using a boolean flag within WorkflowContext
. Currently, there's no way to directly check this within the workflow code.
Here's a breakdown of the issue and proposed solution:
Problem:
Proposed Solution:
isWorkflowTaskFromReset
Flag: Introducing a boolean flag within WorkflowContext
called isWorkflowTaskFromReset
would provide a way to identify workflow tasks initiated by a reset.Benefits:
Example:
// Within a workflow implementation
if (Workflow.getExecutionContext().isWorkflowTaskFromReset()) {
// Logic specific to workflow tasks after a reset
// ...
} else {
// Logic for regular workflow tasks
// ...
}
This feature would enhance workflow flexibility and simplify development by providing a direct mechanism to handle workflow reset scenarios.
Related Resources:
By implementing this feature, Temporal would provide developers with more control and clarity when handling workflow resets, leading to more robust and efficient workflow implementations.
Thank you for your feature request.
It's a great idea to be able to identify if a Workflow task is from a reset. This would indeed be very helpful for building more robust and flexible Workflows.
While we don't have this specific feature implemented right now, you could potentially achieve a similar effect using a custom state management mechanism within your Workflow. For example:
We understand the value of this feature and are considering it for future releases. Feel free to share your feedback and use case scenarios in our Support Forum, and we'll be sure to take them into consideration.
Thank you for the feature request. While this is a useful feature, it's not currently supported by the Temporal SDKs.
Here are a few ways to work around this for now:
We appreciate your feedback and will consider it for future enhancements to the Temporal SDKs.
Thank you for your feature request!
It would be helpful to have a boolean flag in the WorkflowContext
indicating whether the current workflow task is from a reset.
Currently, there isn't a direct way to determine this using WorkflowContext
, but you can achieve this using the Workflow.getExecutionInfo()
method and comparing the RunId of the current workflow execution with the RunId of the previously completed workflow.
This will help you implement your desired logic for failing the workflow in certain cases and then resetting it.
Thank you for your feature request!
It's a great idea to know whether or not the current task is from a reset. It would allow developers to build more robust workflow logic by handling resets specifically.
While this feature isn't currently available, you can achieve a similar outcome by incorporating custom logic into your workflow. Here's a possible workaround:
isReset
) within your workflow. Initialize it to false
at the start.isReset
state variable to true
. You can achieve this within the workflow definition itself or using the Temporal CLI command temporal workflow reset
.isReset
state variable to determine whether the current execution is a result of a reset.isReset
, implement logic to handle the reset scenario. This might involve skipping certain activities or performing specific tasks related to the reset.This approach provides you with the flexibility to implement custom handling for reset scenarios within your workflow.
Let us know if you have any other questions.
Thanks for the feature request! Currently, there is no way to identify whether a workflow task is from a reset. We understand that this information would be useful for workflow logic, especially when it comes to failures and restarts.
A possible workaround for your use case would be to use a custom flag in your workflow state. You could set this flag when you initiate a reset, and then check it in your workflow logic. This would allow you to tailor your workflow behavior based on whether a reset has occurred.
We will consider adding a flag like the one you suggested to WorkflowContext
for a future release.
Is your feature request related to a problem? Please describe.
It's not possible to know whether or not the current task is from a reset. It would be much simpler to build a logic in workflow to fail on certain case (to stop all the activities), then I will reset it later to resume.
Describe the solution you'd like
Expose a boolean flag in WorkflowContext to indicate whether the current workflow task is from a reset?(basically if the previous task is workflow task failed with reason of Reset)