0

根据 MassTransit 文档,我已为我的 RabbitMQ 总线启用加密:

bus = Bus.Factory.CreateUsingRabbitMq(rabbit =>
{
    rabbit.Durable = true;
    
    rabbit.Host(new Uri(settings.ServerUri), h =>
    {
        h.Username(settings.Username);
        h.Password(settings.Password);
    });

    rabbit.ClearMessageDeserializers();
    rabbit.UseEncryption(Convert.FromBase64String("..."));

    ...
});

我还添加了对路由单完成事件的订阅:

var builder = new RoutingSlipBuilder(NewId.NextGuid());
builder.AddActivity(...);
await builder.AddSubscription(queueUri, RoutingSlipEvents.Completed,
                x => x.Send<xxxRoutingSlipCompleted>(new { ctx.Data.CorrelationId }));

虽然所有其他消息都按预期加密,但路由滑动事件以纯文本形式发送(可以在 RabbitMQ 队列中看到)并导致以下异常:

System.Runtime.Serialization.SerializationException: 
No deserializer was registered for the message content type: application/vnd.masstransit+json.
Supported content types include application/vnd.masstransit.v2+aes 
at MassTransit.Serialization.SupportedMessageDeserializers.Deserialize(ReceiveContext receiveContext) 
at MassTransit.Pipeline.Filters.DeserializeFilter.Send(ReceiveContext context, IPipe`1 next) 
at GreenPipes.Filters.RescueFilter`2.GreenPipes.IFilter<TContext>.Send(TContext context, IPipe`1 next)

是否有一些额外的配置需要应用于路由单(我在 ISendEndpoint 界面上看不到任何相关内容)或者这是 MassTransit 中的错误?

4

0 回答 0