【发布时间】:2021-08-25 07:54:18
【问题描述】:
我有 3 个微服务如下通过masstransit/rabbitmq 进行通信
我希望Api 向TransactionService 发出请求,但得到了PspService 的响应。
namespace API
{
//I wish to have something like this
PaymentForm form = await requestClient.GetResponse<PaymentForm>(new CreatePayment())
}
namespace TransactionService
{
public class CreatePaymentConsumer : IConsumer<CreatePayment>
{
public async Task Consume(ConsumeContext<CreatePayment> context)
{
context.Send<BuildPaymentForm>()
}
}
}
namespace PspService
{
public class BuildPaymentFormConsumer : IConsumer<BuildPaymentForm>
{
public async Task Consume(ConsumeContext<BuildPaymentForm> context)
{
context.Response<PaymentForm>() //how to make sure that the response will be sent to the API, but not to the caller (TransactionService)?
}
}
}
请指出制作这种通信模式或类似示例的正确方法,或文档中的正确部分。
【问题讨论】:
标签: c# rabbitmq masstransit