Book Image

Learning NServiceBus - Second Edition

By : David Boike
Book Image

Learning NServiceBus - Second Edition

By: David Boike

Overview of this book

Table of Contents (18 chapters)
Learning NServiceBus Second Edition
About the Author
About the Reviewers

Web service integration and idempotence

When talking about managing failure, it's important to spend a few minutes discussing web services because they are such a special case; they are just too good at failing.

In the previous chapter, we discussed only doing as much work within a message handler as you can reliably perform within the scope of one transaction. For database operations, this limitation is obvious. For some other non-transactional operations (sending email comes to mind), it is easy to isolate that operation within its own message handler. When the message is processed, the email would either be sent or it won't; there really aren't any in-between cases.


In reality, when sending an email, it is technically possible that we could call the SMTP server, successfully send an email, and then the server could fail before we are able to finish marking the message as processed. However, in practice, this chance is so infinitesimal that we generally assume it to be zero. Even if...