1

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.

kvuong
  • 485
  • 3
  • 20

1 Answers1

0

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.

Chris Patterson
  • 28,659
  • 3
  • 47
  • 59