C
C#11mo ago
M B V R K

❔ Reference to type 'IReceiveEndpointConfigurator' claims it is defined in 'MassTransit'

Hello friends, I have a Microservice which using the MassTransit as an Abstraction over RabbitMQ, I created a separated class the constains an extension method to register and configure the MassTransit settings:
public static class RabbitMQRegistrar
{
public static void ConfigureRabbitMQ(this IServiceCollection services, IConfiguration configuration)
{
var rabbitMqOptions = configuration.GetSection("RabbitMQ:Settings").Get<RabbitMqOptions>();
var authServiceRabbitMqEndPointsOptions = configuration.GetSection("RabbitMQ:EndPoints:AuthService").Get<AuthServiceRabbitMqEndpointsOptions>();
var authServiceRabbitMqEndPoints = authServiceRabbitMqEndPointsOptions;


services.AddMassTransit(busConfigurator => busConfigurator.AddBus(provider => Bus.Factory.CreateUsingRabbitMq(cfg =>
{
cfg.Host(rabbitMqOptions.HostName, hostConfig =>
{
hostConfig.Username(rabbitMqOptions.UserName);
hostConfig.Password(rabbitMqOptions.Password);
});

cfg.ReceiveEndpoint(authServiceRabbitMqEndPoints.UserCreatedEventQueue, ep => ep.Consumer<AuthServiceUserCreatedMessageConsumer>(provider));

})));

services.ConfigureRabbitMQBaseOptions(configuration);
}
}
public static class RabbitMQRegistrar
{
public static void ConfigureRabbitMQ(this IServiceCollection services, IConfiguration configuration)
{
var rabbitMqOptions = configuration.GetSection("RabbitMQ:Settings").Get<RabbitMqOptions>();
var authServiceRabbitMqEndPointsOptions = configuration.GetSection("RabbitMQ:EndPoints:AuthService").Get<AuthServiceRabbitMqEndpointsOptions>();
var authServiceRabbitMqEndPoints = authServiceRabbitMqEndPointsOptions;


services.AddMassTransit(busConfigurator => busConfigurator.AddBus(provider => Bus.Factory.CreateUsingRabbitMq(cfg =>
{
cfg.Host(rabbitMqOptions.HostName, hostConfig =>
{
hostConfig.Username(rabbitMqOptions.UserName);
hostConfig.Password(rabbitMqOptions.Password);
});

cfg.ReceiveEndpoint(authServiceRabbitMqEndPoints.UserCreatedEventQueue, ep => ep.Consumer<AuthServiceUserCreatedMessageConsumer>(provider));

})));

services.ConfigureRabbitMQBaseOptions(configuration);
}
}
The issue : The issue is I get a compile time error in this line :
cfg.ReceiveEndpoint(authServiceRabbitMqEndPoints.UserCreatedEventQueue, ep => ep.Consumer<AuthServiceUserCreatedMessageConsumer>(provider));
cfg.ReceiveEndpoint(authServiceRabbitMqEndPoints.UserCreatedEventQueue, ep => ep.Consumer<AuthServiceUserCreatedMessageConsumer>(provider));
That error says :
Reference to type 'IReceiveEndpointConfigurator' claims it is defined in 'MassTransit', but it could not be found
And I'm sure that this microservice/project has the MassTransit installed. Please any help ? <3
6 Replies
JakenVeina
JakenVeina11mo ago
sounds like a versioning issue
M B V R K
M B V R K11mo ago
means what exactly related to versioning ?
JakenVeina
JakenVeina11mo ago
as in, the version of MassTransit that you're compiling against does not define IReceiveEndpointConfigurator
M B V R K
M B V R K11mo ago
after removing this package :MassTransit.Extensions.DependencyInjection it works fine massive thanks
JakenVeina
JakenVeina11mo ago
gg
Accord
Accord11mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.