11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 8 ■ IMPLEMENTING RELIABLE MESSAGING AND QUEUE-BASED COMMUNICATIONS 251ramrameshreddy.blog.comFor example, if the server application is down for a period of time longer than the timeoutdefined in the client application, the message will indeed never be delivered. Or if you persistmessages to a durable store—that is, you write these to the disk on the client side but no suchstrategy exists on the server side—there really is no reliability. Although the implementationdoes in fact take into account the requirements for reliability, at least for version 1 of WCF,there is no real support for durability. The WS-ReliableMessaging specification specifies onlythat the receiving endpoint is required to send an acknowledgment that the message hasindeed been received.Despite these limitations, in the scenario that both ends of the application—that is, theclient endpoint and the server endpoint—are indeed up and running, reliable messagingoffers you a host of advantages. The failures at the transport level are overcome, more oftenthan not without writing a single line of additional code.Challenges of Implementing Reliable MessagingImplementing reliable messaging has multiple challenges. We’ll broadly categorize them intocommunication issues and processing issues. More often than not, these are interrelated challengesthat are nontrivial in nature to solve.Communication IssuesCommunication issues typically revolve around the physical transport. In a service-orientedworld, the quality of the communication layer is often not within our control. The main communicationissues are the following:<strong>Net</strong>work issues: The actual physical network is not available. So, what happens to yourmessages? Do you compensate for this? How do you compensate for this? The server isdown or the router is struggling to cope with high levels of network congestion.Connection drops: You send the message; however, the connection to the destination islost before the message arrives at the destination. How do you detect the drop, and moreimportant, how do you recover from this? In this scenario, say your machine has the networkcable unplugged or the wireless card on the laptop momentarily blinks. Prior toWCF, the messages would be lost, unless of course you had envisioned this and writtenlots of code to overcome the scenario.Lost messages: This is much like the load of laundry that loses one sock. You don’t knowwhat happened to your message. You sent it, the network was available, and your connectionwas stable, but for some reason the message didn’t arrive at the destination. How doyou prevent this situation?ramrameshreddyramrameshreddyOut-of-order messages: You put in a sell order for MSFT stock, the proceeds of which youwant applied to the purchase of a really hot energy stock. Naturally the sell order needs toarrive before the purchase; otherwise, your account will not have the adequate funds tobuy the energy stock. How do you go about avoiding this scenario?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!