GetSendEndpoint should raise exception on non-existing queue
See original GitHub issueIs this a bug report?
Yes
Can you also reproduce the problem with the latest version?
Yes
Environment
- Operating system: Windows 10 Enterprise 64-bit
- Visual Studio version: VS 2017
- Dotnet version: .NET Framework 4.6.2
Steps to Reproduce
- Have a RabbitMQ running locally
- Create a new Console application
- Paste following code:
static void Main()
{
var mtBus = Bus.Factory.CreateUsingRabbitMq(busFactoryConfig =>
{
busFactoryConfig.Host(new Uri("rabbitmq://localhost"), hostConfig =>
{
hostConfig.Username("admin");
hostConfig.Password("admin");
});
});
mtBus.Start();
//should raise exception
var result = mtBus.GetSendEndpoint(new Uri("rabbitmq://localhost/testQueue?queue=testQueue&bind=false")).GetAwaiter().GetResult();
}
- the last line, GetSendEndpoint should throw an
EndpointNotFoundExceptionbecause testQueue does not exist on RabbitMQ.
No vhost is configured.
Expected Behavior
GetSendEndpoint should throw an EndpointNotFoundException because testQueue does not exist on RabbitMQ.
Actual Behavior
It just continues and creates an exchange with name testQueue with no bindings, messages are discarded.
Reproducible Demo
Run a local RabbitMQ server and create a console app with code below:
static void Main()
{
var mtBus = Bus.Factory.CreateUsingRabbitMq(busFactoryConfig =>
{
busFactoryConfig.Host(new Uri("rabbitmq://localhost"), hostConfig =>
{
hostConfig.Username("admin");
hostConfig.Password("admin");
});
});
mtBus.Start();
//should raise exception
var result = mtBus.GetSendEndpoint(new Uri("rabbitmq://localhost/testQueue?queue=testQueue&bind=false")).GetAwaiter().GetResult();
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
MassTransit RabbitMq Sending Messages
I am not able to figure out on how to specify the Exchange and Queue in my GetSendEndpoint()) task when sending / publishing...
Read more >Exceptions
With this consumer, an ADOException can be thrown, say there is a deadlock or the SQL server is unavailable. In this case, the...
Read more >Producers
Producers. An application or service can produce messages using two different methods. A message can be sent or a message can be published....
Read more >MassTransit Exception Handling, Retry Middleware - YouTube
Episode Five describes how to configure consumers and sagas to retry exceptions using definitions. The error queue is covered, including how ...
Read more >MassTransit Send vs. Publish
This tutorial will look at what is happening with the two different message types. To follow along, download the completed project here.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Exchange is still created in the latter way. Anyway, my question was different…
Expected Behavior GetSendEndpoint should throw an EndpointNotFoundException because testQueue does not exist on RabbitMQ.
In response to our chat on Gitter; Indeed the behavior was always the same, GetSendEnpoint never threw an exception in previous versions of MassTransit. I’m just questioning the design, A
Sendshould always put the given message in the given queue right? If queue/exchange doesn’t exist, then an exception should be thrown in my opinion. Just like themandatoryparameter when doing a publishOh cool, just discovered short addresses, coming from an older version of MT. For others like me:
var result = mtBus.GetSendEndpoint(new Uri("queue:testQueue"));