Reputation: 6239
I'm using an ASP.NET MVC application to send messages to an nServiceBus host on another machines. I'm using
Bus.CreateSendOnly(busConfiguration);
over
Bus.Create(busConfiguration);
since the SendOnly
configuration seems closer to the functionality I'm expecting.
Are there any advantages to making this change besides slightly improved code readability? Does nServiceBus dependency injection behaviour differ, improve performance etc??
Upvotes: 0
Views: 369
Reputation: 6505
CreateSendOnly
bypasses all the processes associated with establishing, verifying and monitoring an input queue to the current process. Depending on your transport layer this may or may not be significant.
It is recommended in a process that doesn't actually handle any commands or subscribe to any events, both because those overheads are unnecessary, and as you say, it enhances clarity of intent.
A typical process that would have a Send Only bus is a web app or api that is receiving requests and converting them to commands to be processed by endpoint services - sending the commands in a 'fire and forget' mode where it doesn't care about the outcome.
Upvotes: 7