我在Asp.Net Core应用程序中有一个简单的传奇配置:
services.AddSingleton<ISagaRepository<Request>,InmemorySagaRepository<Request>>();
services.AddMassTransit(x =>
{
x.AddSagaStateMachine<RequestStateMachine,Request>();
x.AddRequestClient<IRequestCreated>();
x.AddBus(provider => Bus.Factory.CreateUsingInmemory(cfg =>
{
cfg.UseInmemoryOutbox();
cfg.ConfigureEndpoints(provider);
}));
});
如果以后我通过IRequestClient<IRequestCreated>
向Saga发送消息:
var client = context.RequestServices.GetService<IRequestClient<IRequestCreated>>();
var response = await client.GetResponse<RequestCreatedResponse>(new
{
CorrelationId = Guid.NewGuid(),ClientId = 1,});
一切正常。但是,如果我在IBus
上尝试相同的操作:
var mtbus = context.RequestServices.GetService<IBus>();
await mtbus.Send<IRequestCreated>(new
{
CorrelationId = Guid.NewGuid(),});
我收到错误A convention for the message type Sample.AspNetCore.Host.Saga.IRequestCreated was not found
我想念什么?