我正在尝试使用RabbitMQ将我的代码从旧版Masstransit更新到它的新版本(第3版),我想使用我的旧代码所在的请求/响应模式:
public static void SendCommand<TCommand>(this IServiceBus bus, TCommand command, Action<InlineRequestConfigurator<TCommand>> callback) where TCommand : CommandBase
{
command.Validate();
bus.PublishRequest(command, callback); // Here is my problem
}
我找不到PublishRequest()
中IBusControl
的替代方法,我认为它已定义而不是IServiceBus
。
任何帮助都会受到赞赏。
答案 0 :(得分:2)
您是否真的需要发布您的请求(而不是将其发送到特定端点)?通常应将请求发送到特定端点。
这在文档中有详细描述: http://docs.masstransit-project.com/en/latest/usage/request_response.html
你的方法被称为SendCommand的事实使得这种共鸣非常好。
答案 1 :(得分:0)
我相信您想要的是IBus
接口,因为在{3}中删除了IServiceBus
。IBus
只是接口的集合,因此您可以使用最低的公共接口支持您需要的方法。