Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support workflow variables #27

Open
gurmitteotia opened this issue Oct 26, 2018 · 0 comments
Open

Support workflow variables #27

gurmitteotia opened this issue Oct 26, 2018 · 0 comments
Projects

Comments

@gurmitteotia
Copy link
Owner

gurmitteotia commented Oct 26, 2018

It will be quite useful if user can store workflow specific state in variable. At the moment user will use either database or probably marker workflow action.

Here is how user can create workflow specific variables:

[WorkflowDescription("1.0")
public class OrderWorkflow : Workflow
{
  //Initialization is not needed
   private Variable<bool> _state1 = new Variable<bool>();
   private Variable<string> _state2 = new Variable<string>();
   private Variable<CustomObject> _state3 = new Variable<CustomObject>();
   [WorkflowVariable]
   private int _id =0;   

  //You can access these variables when workflow is executed
  [WorkflowEvent(EventName.Signal)]
  public WorkflowAction OnSignal(string signalName)
  {
     if(signalName == "set")
     {
            _state= true;
     }
     if (signalName  == "get")
    {
        if(_state.Value)
          return CompleteWorkflow("done");
    }
   return Ignore;
  }
}

Implementation note:

  • Should store the variables in execution state.
  • Lazy load the variables, when the first variable is accessed by calling DescribeWorkflowExecution API. This will avoid penalising the users who do not want to user variables.
  • Total deserialized JSON length of variables should not exceed the length of 32768.
@gurmitteotia gurmitteotia added this to To Do in Guflow via automation Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Guflow
  
To Do
Development

No branches or pull requests

1 participant