Last active
March 16, 2021 14:05
-
-
Save frankhale/4ea7a98af9451a71943ecd77efc66d55 to your computer and use it in GitHub Desktop.
MassTransit ASPNET Core Azure ServiceBus config fail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddControllers(); | |
var queueTopic = "topic name here"; | |
var sendQueueConnectionString = "Send EndPoint Connection String Here"; | |
var receiveQueueConnectionString = "Receive EndPoint COnnection String Here"; | |
// My intent is to have this ASPNET Core API publish and also be a consumer | |
var azureServiceBusSend = Bus.Factory.CreateUsingAzureServiceBus(busFactoryConfig => | |
{ | |
busFactoryConfig.Message<MyMessage>(configTopology => | |
{ | |
configTopology.SetEntityName(queueTopic); | |
}); | |
busFactoryConfig.Host(sendQueueConnectionString, hostConfig => { }); | |
}); | |
var azureServiceBusReceive = Bus.Factory.CreateUsingAzureServiceBus(busFactoryConfig => | |
{ | |
busFactoryConfig.Message<MyMessage>(x => { x.SetEntityName(queueTopic); }); | |
busFactoryConfig.Host(receiveQueueConnectionString, hostConfig => { }); | |
busFactoryConfig.ReceiveEndpoint(queueTopic, config => | |
{ | |
config.Consumer<MyMessageConsumer>(); | |
}); | |
}); | |
services.AddMassTransit(config => | |
{ | |
config.AddBus(provider => azureServiceBusSend); | |
}); | |
services.AddSingleton<IPublishEndpoint>(azureServiceBusSend); | |
services.AddSingleton<ISendEndpointProvider>(azureServiceBusSend); | |
services.AddSingleton<IBus>(azureServiceBusSend); | |
} |
Thanks, guys. This was my problem. It's starting to come together, now!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was my mistake ^