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.com270 CHAPTER 8 ■ IMPLEMENTING RELIABLE MESSAGING AND QUEUE-BASED COMMUNICATIONSramrameshreddy.blog.comThe MSMQ transport channel at the sender places the body of the WCF message withinthe MSMQ message and sends it via the MSMQ transport. It is the job of the MSMQ transportchannel stack at the receiver to unpack the WCF message from the MSMQ message and thento dispatch it as an invocation operation on the WCF service. The common theme in WCF isthat the real work of messaging is in the channel, which abstracts out most of the complexitiesinvolved from the developer to make life simpler.Implementing the MSMQ transport channel in WCF to integrate two WCF endpoints, asyou have seen, is a straightforward task. Let’s now look at the integration channel.Integration ChannelsMassive amounts of applications have already been deployed and will not be thrown awaybecause of an emerging set of tools. We would prefer the world to become WCF compliantovernight, but the chances of that happening are slim.WCF addresses this issue with a practical solution. The queuing channel within WCFoffers the concept of integration channels, which should be used to communicate with thelegacy applications that use MSMQ. The integration channel for queues in WCF continues touse the classic MSMQ messaging formats and is implemented via the MsmqIntegrationBindingbinding.What is occurring here is that the MSMQ message is mapped out to a WCF message and,once this has been achieved, invokes the WCF service. Alternatively, when you have a WCFapplication sending out a message, the reverse of the previous occurs. The properties of theWCF message are mapped back to those available in the legacy MSMQ message format, thusenabling the legacy application to consume the message.The next section discusses the two scenarios in greater detail.Integrating a WCF Client with an MSMQ ReceiverLeveraging existing investments in applications is a scenario that you will witness fairly often.Typically you will find that your key business processes are on opposite sides of the queue,and typically one of them will not be a WCF application.In this scenario, the WCF client will hand the message to the integration channel, whichwill convert it to the MSMQ message format. Then the queue manager will store it in its localstore. When the receiver MSMQ application becomes available, it will hand the message overto the queue manager for the receiver application and be consumed, as shown in Figure 8-7.WCF ApplicationMSMQMSMQCommunicationWCF ServiceMSMQramrameshreddyramrameshreddyPersistent StorePersistent StoreFigure 8-7. Integrating with an MSMQ application

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

Saved successfully!

Ooh no, something went wrong!