Let's say your handler looks something like this:
public class SomeCommandHandler : IHandleMessages<SomeCommnand>
{
public void Handle(SomeCommnand message)
{
// write to the database and save changes
throw new Exception("Oh noes!");
}
}
If you don't have your handler wrapped in a TransactionScope
, I'm guessing (so please test on your own), that your data would be written but your message would be retried (rightfully so, because it failed). This would give you the impression that you got the message twice.
But why are you doing anything that's non-transactional? That kinda defeats the purpose of NServiceBus.
If you are doing things like HTTP requests or other long-running things along with your basic DB interaction, then you want to use a Saga, not a simple command handler.