Delivery Failures

As discussed in Chapter 6, a connected call may fail due to either communication failures or service-side errors. Similarly, a queued call can fail due to delivery failures or service-side playback errors. WCF provides dedicated error-handling mechanisms for both types of errors, and understanding them and integrating your error-handling logic with them is an intrinsic part of using queued services.

While MSMQ can guarantee delivery of a message if it is technically possible to do so, there are multiple examples of when it is not possible to deliver the message. These include but are not limited to:

Timeouts and expiration

As you will see shortly, each message has a timestamp, and the message has to be delivered and processed within the configured timeout. Failure to do so will cause the delivery to fail.

Security mismatches

If the security credentials in the message (or the chosen authentication mechanism itself) do not match up with what the service expects, the service will reject the message.

Transactional mismatches

The client cannot use a local nontransactional queue while posting a message to a transactional service-side queue.

Network problems

If the underlying network fails or is simply unreliable, the message may never reach the service.

Machine crashes

The service machine may crash due to software or hardware failures and will not be able to accept the message to its queue.

Purges

Even if the message is delivered successfully, the administrator (or any ...

Get Programming WCF Services, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.