Need StateMachine's Activity examples

431 Views Asked by At

I'm learning MassTransit's StateMachine, it's helpful in my usecase, really like it, now I would like to learn more about how to use Activity properly but it's hard to find document/examples, please help me with some questions:

  1. What do Probe and Accept methods do? For example:

     public void Probe(ProbeContext context)
     {
         context.CreateScope("foo");
     }
    
     public void Accept(StateMachineVisitor visitor)
     {
         visitor.Visit(this);
     }
    

What are Scope and Visitor?

  1. I chain 2 Activities like this

    .Activity(x=>x.OfType<FirstActivity>())

    .Activity(x=>x.OfType<SecondActivity>())

In FirstActivity.Execute method, it throws Exception but SecondActivity.Faulted never hit, how to set them up correctly?

Thank you.

1

There are 1 best solutions below

0
Chris Patterson On

There are many activities in this project you can use to see how they're created.

And if your first activity throws an exception, the next activity and any other subsequent activities won't be called because an exception was thrown and not handled. You can use a .Catch state machine expression to configure exception handlers.