I'm adding a new handler to an existing application with rebus support, but for the new message I sometimes get the following exception when I send a message:
Could not get .NET type named 'AuthorizationsService.MessageContracts.AuthorizationUsage.SaveAuthorizationUsageCommand, AuthorizationsService.MessageContracts'
at Rebus.Serialization.Json.JsonSerializer.GetTypeOrNull(TransportMessage transportMessage)
at Rebus.Serialization.Json.JsonSerializer.GetMessage(TransportMessage transportMessage, Encoding bodyEncoding)
at Rebus.Serialization.Json.JsonSerializer.Deserialize(TransportMessage transportMessage)
at Rebus.Compression.UnzippingSerializerDecorator.Deserialize(TransportMessage transportMessage)
at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(IncomingStepContext context, Func`1 next)
at Rebus.Encryption.DecryptMessagesIncomingStep.Process(IncomingStepContext context, Func`1 next)
at Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(IncomingStepContext context, Func`1 next)
at Rebus.Pipeline.Receive.HandleDeferredMessagesStep.Process(IncomingStepContext context, Func`1 next)
at Rebus.Retry.Simple.DefaultRetryStep.Process(IncomingStepContext context, Func`1 next)
The strange thing is that not every message I send results in this exception, but only every other message (one fails, one succeeds etc.).
The message contains the following header:
rbs2-msg-type: AuthorizationsService.MessageContracts.AuthorizationUsage.SaveAuthorizationUsageCommand, AuthorizationsService.MessageContracts
AuthorizationsService.MessageContracts is a seperate project within the solution of the application that consumes the messages.
This is the DI setup for Rebus that I use:
builder.Services.AddRebus(c =>
{
c.Transport(t => t.UseRabbitMq(rebusOptions.RabbitMQConnectionString, rebusOptions.ListeningQueue));
c.Logging(l => l.Serilog());
c.Serialization(s =>
{
s.UseNewtonsoftJson(new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All });
});
c.Options(o =>
{
o.EnableEncryption(rebusOptions.RebusEncryptionKey);
o.SetMaxParallelism(rebusOptions.MaxParallelism);
o.SetNumberOfWorkers(rebusOptions.MaxWorkers);
o.SetBusName($"{rebusOptions.ListeningQueue}Bus");
o.LogPipeline(rebusOptions.PipelineVerboseLogging);
o.RetryStrategy(maxDeliveryAttempts: 1, secondLevelRetriesEnabled: true);
o.EnableDiagnosticSources();
o.ValidateOutgoingMessages();
});
c.Routing(r => r.TypeBased().AddMappingsFromConfiguration(builder.Configuration, "RebusRouting"));
c.Timeouts(t => t.StoreInSqlServer(rebusOptions.RebusDbConnectionString, rebusOptions.TimeoutTableName));
return c;
});
builder.Services.AutoRegisterHandlersFromAssembly(typeof(AssemblyMarker).Assembly);
Any help would be greatly appreciated!
I'm adding a new handler to an existing application with rebus support, but for the new message I sometimes get the following exception when I send a message:
The strange thing is that not every message I send results in this exception, but only every other message (one fails, one succeeds etc.).
The message contains the following header:
rbs2-msg-type: AuthorizationsService.MessageContracts.AuthorizationUsage.SaveAuthorizationUsageCommand, AuthorizationsService.MessageContracts
AuthorizationsService.MessageContracts is a seperate project within the solution of the application that consumes the messages.
This is the DI setup for Rebus that I use:
Any help would be greatly appreciated!