Is there any way to handle NotAcceptedStateMachineException in generic way e.g. return to client some user friendly message in request-response approach?
Automatonymous.NotAcceptedStateMachineException: ExampleSagaState(8dc388ea-99b3-4d21-a3e5-915c4185ec12) Saga exception on receipt of IExampleRequest: Not accepted in state ExampleState
---> Automatonymous.UnhandledEventException: The ExampleEvent event is not handled during the ExampleState state for the ExampleStateMachineSaga state machine
at Automatonymous.AutomatonymousStateMachine`1.DefaultUnhandledEventCallback(UnhandledEventContext`1 context)
at Automatonymous.AutomatonymousStateMachine`1.UnhandledEvent(EventContext`1 context, State state)
at Automatonymous.States.StateMachineState`1.Automatonymous.State<TInstance>.Raise[T](EventContext`2 context)
at Automatonymous.AutomatonymousStateMachine`1.Automatonymous.StateMachine<TInstance>.RaiseEvent[T](EventContext`2 context)
at Automatonymous.Pipeline.StateMachineSagaMessageFilter`2.Send(SagaConsumeContext`2 context, IPipe`1 next)
--- End of inner exception stack trace ---
at Automatonymous.Pipeline.StateMachineSagaMessageFilter`2.Send(SagaConsumeContext`2 context, IPipe`1 next)
at Automatonymous.Pipeline.StateMachineSagaMessageFilter`2.Send(SagaConsumeContext`2 context, IPipe`1 next)
at MassTransit.Saga.SendSagaPipe`2.Send(SagaRepositoryContext`2 context)
at MassTransit.Saga.SendSagaPipe`2.Send(SagaRepositoryContext`2 context)
at MassTransit.RedisIntegration.Contexts.RedisSagaRepositoryContextFactory`1.Send[T](ConsumeContext`1 context, IPipe`1 next)
at .MassTransit.RedisIntegration.Contexts.RedisSagaRepositoryContextFactory`1.Send[T](ConsumeContext`1 context, IPipe`1 next)
at MassTransit.Saga.Pipeline.Filters.CorrelatedSagaFilter`2.GreenPipes.IFilter<MassTransit.ConsumeContext<TMessage>>.Send(ConsumeContext`1 context, IPipe`1 next)
I'm using request/response to execute a state machine:
IRequestClient<IExampleRequest> client = this._busControl.CreateRequestClient<IExampleMessage>(address, (MassTransit.RequestTimeout)Timeout);
Response<IExampleResponse> response = await client.GetResponse<TRes>(message, new CancellationToken(), new MassTransit.RequestTimeout()).ConfigureAwait(false);
I'd like to get a response of that TRes type but instead the timeout is shown. I have tried to handle this by using OnUnhandledEvent but here i'm losing info about response type so i can't send it back. Any ideas how to solve that? Thanks
Without seeing the state machine code, it's purely a guess, but the error message is clear. The state machine isn't in a state where that event is handled.
I'd suggest reviewing some samples covering state machine, if possible watching the entire season of videos discussing that sample, state machines, and how they work in MassTransit.