I am using the code below to setup MassTransit to use ServiceBus
private static ServiceProvider SetupServiceCollection()
{
var connectionString = ConfigurationManager.AppSettings["AzureServiceBusConnectionString"];
var services = new ServiceCollection()
.AddMassTransit(x =>
{
x.UsingAzureServiceBus((context, cfg) =>
{
cfg.Host(connectionString);
cfg.ConfigureEndpoints(context);
cfg.Message<MyMessage>(x =>
{
x.SetEntityName("my-topic");
});
});
});
return services.BuildServiceProvider();
}
I use the following code to send a message
var message = new MyMessage()
{
MessageIdentifier = Guid.NewGuid().ToString(),
};
await _busControl.Publish(message);
I want my message to be sent to my-topic only
However, MassTransit is creating topic, the names seem to be getting generated using the type names. How do I totally stop this?
I am setting up the receiver as below
public static void SetupMassTransit(this ServiceCollection services, string connectionString)
{
services.AddMassTransit(x =>
{
x.UsingAzureServiceBus((context, cfg) =>
{
cfg.Host(connectionString);
cfg.ConfigureEndpoints(context);
x.UsingAzureServiceBus((context, cfg) =>
{
cfg.Host(connectionString);
cfg.SubscriptionEndpoint<MyMessage>("low", e =>
{
e.Consumer<MyMessageConsumer>(context);
e.PrefetchCount = 100;
e.MaxConcurrentCalls = 100;
e.LockDuration = TimeSpan.FromMinutes(5);
e.MaxAutoRenewDuration = TimeSpan.FromMinutes(30);
e.UseMessageRetry(r => r.Intervals(100, 200, 500, 800, 1000));
e.UseInMemoryOutbox();
e.ConfigureConsumeTopology = false;
});
});
});
}
I can see that the message is being sent correctly, as its shown inside the subscription in Service Bus Explorer. However, the receiver is not picking it up? There are no errors or anything to go on? Really frustrating
Paul