Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Create a Durable and Reliable WCF Service with MSMQ 4.0 : Page 3

Developers have to ensure that their Windows Communication Foundation (WCF) endpoints are durable and reliable, because transactions depend on them. Learn how to bullet proof your WCF services with MSMQ 4.0.


advertisement
Setting Up the Windows 2008 Cluster
The Windows 2008 cluster you will set up is an active/passive cluster with two nodes, A and B (see Figure 5 for the basic infrastructure that will be required). These two nodes point to a SAN (Storage Area Network). The installation and setup of the cluster are the keys to getting durable and guaranteed delivery. It takes a while to get set up and configured, but once that's done the magic starts to happen.

The hardware installation of the cluster is out of scope of this article. Please refer to MSDN for detailed instructions. Be patient because it takes a while and you will need to add the servers to Active Directory to reach it from the outside.

Click to enlarge

Figure 5. Basic Infrastructure of the Windows 2008 Cluster:
The Windows 2008 cluster you will set up is an active/passive cluster with two nodes, A and B.



Install Required Software in Both Node A and B
Install the following components on both the nodes (as shown in Figure 6):

  • All features under Windows Process Activation Service (Process Model, .NET environment, Configuration APIs)
  • Non-HTTP Activation under WCF activation in .NET Framework 3.0 features
  • Message queuing server, directory service integration, and routing service

Click to enlarge

Figure 6. Required Components on the Windows Cluster:
The Windows 2008 cluster you will set up is an active/passive cluster with two nodes, A and B.

The queue name on these two nodes should be the same as the one in the local machine where the Order Service is running. For security reasons, the queue should have at least a domain account that is the same as the one the Windows service account used to run the Order Service.

Install Distributed Transaction Coordinator
The Distributed Transaction Coordinator (DTC) is the component that manages transactions across the various machines. It needs to be set up with both inbound and outbound messages allowed. Some of the options you can use to set this up are shown in Figure 7.

Click to enlarge

Figure 7. Setting Up DTC:
DTC needs to be set up with both inbound and outbound messages allowed.

After you have set up and installed the cluster, you should have three queues.

  • \\nodea\private\\OrderService
  • \\nodeb\\private\\OrderService
  • \\virtualnode\\private\\OrderService

The virtual node is the one you will use instead of localhost in the app.config file.

Listing 2 shows the configuration pointing to the cluster node of the MSMQ. Note the identity section that controls the security between the sender of the message and the Windows cluster. In Listing 2, the domain is called userPrincipalName value="domainame\_serviceaccount". The service and the queue run under the same account, _serviceaccount. (Change this to whatever account your service is running under.)

Creating a Gateway
NetMSMQ endpoints can be reached only from another .NET 3.5-compliant service, which limits the usage of the service. If interop is important to you, consider writing a gateway service like the one shown in Figure 8, which can take an incoming request in a interoperable format (SOAP12) and forward it to the actual Order Service.

Click to enlarge

Figure 8. Gateway Service Proxying Calls to Service:
If interop is important to you, consider writing a gateway service like this.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date