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.

amrameshreddy.blog.com256 CHAPTER 8 ■ IMPLEMENTING RELIABLE MESSAGING AND QUEUE-BASED COMMUNICATIONSramrameshreddy.blog.comYou will make similar changes to your client App.config file as well.We recommend that you test this application using multiple machines. Put the serverapplication on one machine and the client on the other. Ensure that you can invoke the service;once you have verified this, you can simulate problems. For example, remove the networkcable from the server to simulate an intermittent connection, and try calling the service. If theexecuting thread blocks until the connection becomes available, then as soon as you plug theserver back in, you will notice that the call will complete successfully. The magic of reliablesessions is in fact implemented by the ReliableSessionBindingElement class, which you willlook at more in depth next.MOVING LARGE VOLUMES OF DATA RELIABLYMoving large amounts of data between endpoints is somewhat of a sticky situation. Assume that you have arequirement to move files that are 2GB in size between endpoints in your application. Under most circumstances,streaming offers you an ideal solution.However, imagine that you are streaming this data across the wire and, because of a network outage,you lose the connection. Given that you have implemented reliable messaging in your solution, the messagewill be recovered. Here you have a small issue. When streaming data, the file is considered to be a singlemessage. Let’s assume you transferred 1GB prior to the outage. Therefore, the message will be resent fromthe beginning when the transmission resumes. You will be starting over, which is not only annoying but canbe avoided.The solution is to implement chunking instead of streaming in this scenario. With chunking, the sendingapplication will divide the message into smaller files (for instance, 1,000 files of 2MB). The downside of thisapproach is that the throughput is likely to be lower than that of streaming because of the overhead of reliablemessaging and the chunking taking place. When you need reliability while moving large files, usechunking. You should be aware that chunking per se is not a feature of WCF even though it can be implementedfairly easily. In the end, which threshold will trigger the switch from streaming to chunking is adecision you as an architect will make based upon the operational environment.ramrameshreddyramrameshreddy

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

Saved successfully!

Ooh no, something went wrong!