I am trying to use scheduler in MassTransit state machine saga without specifying the scheduler service address directly.
I use UseMessageScheduler
in the bus configuration and it works fine since I can do context.Schedule
from inside my consumers.
However, it does not work in sagas. When I try to do .Schedule
, I get this error:
A request timeout was specified but no message scheduler was specified or available
I checked the MT code and I see this:
MessageSchedulerContext schedulerContext;
if (_request.Settings.SchedulingServiceAddress != null)
{
ISendEndpoint scheduleEndpoint = await consumeContext.GetSendEndpoint(_request.Settings.SchedulingServiceAddress).ConfigureAwait(false);
await scheduleEndpoint.ScheduleSend(consumeContext.ReceiveContext.InputAddress, expirationTime, message).ConfigureAwait(false);
}
else if (consumeContext.TryGetPayload(out schedulerContext))
await schedulerContext.ScheduleSend(message, expirationTime, Pipe.Empty<SendContext>()).ConfigureAwait(false);
else
throw new ConfigurationException("A request timeout was specified but no message scheduler was specified or available");
So, there is actually a branch that should normally get the scheduler address from the configuration, but why doesn't it work?