IvanD
IvanD

Reputation: 1

MassTransit message encryption and routing slip events

I have enabled encryption for my RabbitMQ bus as per MassTransit documentation:

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("..."));

    ...
});

I have also added subscription for a routing slip completed event:

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

While all other messages get encrypted as expected, routing slip events get sent in plain text (as can be seen in RabbitMQ queue) and result in the following exception:

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)

Is there some additional configuration that needs to be applied to routing slips (I can't see anything relevant on the ISendEndpoint interface) or is this a bug in MassTransit?

Upvotes: 0

Views: 460

Answers (0)

Related Questions