11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 8 ■ IMPLEMENTING RELIABLE MESSAGING AND QUEUE-BASED COMMUNICATIONS 259ramrameshreddy.blog.comallows you to overcome the infrastructure unreliability to a greater extent. Queuing enables youto effectively uncouple the transport for the messages from the actual processing of the message.Moreover, the reliability provided is really only as reliable as the underlying infrastructurein an environment where you do not have control over both endpoints of your application.Figure 8-1 shows conceptually what happens. Figure 8-1 describes using persistent stores to utilizethe MSMQ communication between a WCF application and an MSMQ legacy application.WCF ApplicationMSMQPersistent StoreFigure 8-1. Conceptual MSMQ usage with WCFQueuing in WCFMSMQCommunicationMSMQ LegacyApplicationMSMQPersistent StoreWhile designing distributed applications, selecting a transport is fairly important. Factors thatyou should consider include the requirements of the client and the service but, most important,whether you need a direct transport or a more isolated transport. In other words, unlike adirect transport such as HTTP or TCP where all the communication will fail if the networkgoes down, you want more resilience in the transport to overcome this issue. Typically, using aqueued transport will overcome this scenario, since it is backed by a store (that is, a durabilitycontainer).Out of the box WCF provides the ability to use MSMQ, which is the Microsoft implementationof queued transports at the operating system level. Queues store messages from a sendingapplication on behalf of a receiving application and later forward these messages to the receivingapplication. They ensure the reliable transfer of messages between queues. WCF providessupport for queuing by using Microsoft Message Queuing (MSMQ) as a transport and enablesthe following features:Loosely coupled applications: Sending applications and receiving applications are notdependent upon knowing whether the other is available. Moreover, both ends can sendand receive messages without being dependent upon how quickly the messages are actuallyprocessed. This in effect also makes the overall application achieve higher levels ofavailability.ramrameshreddyramrameshreddyFailure isolation: The fact that loose coupling enables messages to be sent to the queue orreceived from the queue without actually needing the endpoints to be running adds alevel of failure isolation. For example, let’s look at the scenario where the server side of theapplication is unavailable and the client can continue to send messages to the queue.Once the server (receiver) is available, it will pick the messages up and process them.

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

Saved successfully!

Ooh no, something went wrong!