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

Alternative approach to configure the workflow #34

Open
gurmitteotia opened this issue Nov 24, 2018 · 0 comments
Open

Alternative approach to configure the workflow #34

gurmitteotia opened this issue Nov 24, 2018 · 0 comments
Projects

Comments

@gurmitteotia
Copy link
Owner

gurmitteotia commented Nov 24, 2018

In can be handy on some occasion if user can write this workflow using alternate style:

    [WorkflowDescription("1.0")]
    public class OrderWorkflow : Workflow
    {
       private ITimerItem _gracePeriod;
        public OrderWorkflow()
        {
            _gracePeriod = ScheduleTimer("GracePeriod").FireAfter(TimeSpan.FromMinutes(10))
                .OnCancel(_ => Jump.ToLambda("OrderCancelled"));

            ScheduleLambda("ShipOrder").AfterTimer(_gracePeriod);

            ScheduleLambda("OrderCancelled").AfterTimer(_gracePeriod)
                .When(e => false);
        }

        [SignalEvent]
        public WorkflowAction ResetGracePeriod() =>
            _gracePeriod.IsActive ? _gracePeriod.Reset() : Ignore;

        [SignalEvent]
        public WorkflowAction CancelOrder()
            =>_gracePeriod.IsActive ? CancelRequest.For(_gracePeriod) : Ignore;
    }

These are initial ideas and needs more refinement

@gurmitteotia gurmitteotia added this to To Do in Guflow via automation Nov 24, 2018
@gurmitteotia gurmitteotia changed the title Investigate the alternative approach to configure the workflow Alternative approach to configure the workflow Nov 24, 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