A Simple Story to Understand WCF

Posted In Tutorials - By NitiN Kumar Jain On Monday, January 3rd, 2011 With 0 Comments






Pin It


Found an extremely nice story to understand the need of WCF, so thought of sharing..

Long Long time a ago there lived a hard working and a nice architect. He used to work for a travel agent with his small and happy team software professionals. Travel agent had tie ups with many big flight carriers. The nice and hardworking architecture and his team developed a nice booking engine by which you can book tickets through any of the flight carriers. The Travel Agent Company was very happy with the architecture and his team member’s achievements. As time passed by the travel agent’s business grew in multiples.

Travel agent started his own franchise. Travel agent wanted to provide this booking engine service to his franchise. So one fine morning he called the hard working architecture. Architecture was very excited of the new work and started on it day and night.

He prepared a list of franchise and made personal visits to see what infrastructure they had. He saw all the franchise worked in Microsoft Windows platform. Booking engine was located in the main head office and all the franchise should communicate to this booking engine. After discussing with his team members he concluded that the best way to communicate is .NET remoting because the head office where the booking engine was hosted was also on windows platform and the other franchise where also on the same. He then worked day and night with his team members to implement .NET remoting to enable communication between the franchise and the booking engine hosted in the head office. After months he rolled out his project successfully. Travel Agent was very happy with his architecture and the team.

Travel agent was now providing his booking service to his franchise in the most efficient manner. Time passed by and because of the good automated booking service more companies wanted to take the franchise from the travel agent.

But the big issue was many of the franchise did not have windows operating system. They worked on Linux and other Non-Microsoft operating systems. Due to this limitation travel agent was loosing lot of franchise business. So one fine day they again called the Architecture and said that the booking engine should also be available to Non-Microsoft platforms. Architecture again went in to action. He setup a high level team meeting and discussed the best solution on Non-Microsoft platforms. After long discussion’s they concluded Web services as the solution. His team again went in to action and implemented the solution.

So now his booking engine architecture was working with two technologies .NET remoting and Web services. He kept .NET remoting so that he can get speed and performance benefits from common windows platform and he also kept Web services so that he can operate seamlessly with Non-Microsoft platforms.

Travel agent was now at his peak of happiness as he had the world at his tips. Franchise now started making huge ticket bookings through the booking engine.

Booking engine had the capacity of serving 20 tickets / second but it had now to serve 50 tickets / second. End franchise client had to wait to get response and was not able to process the next ticket booking until the first one was served. Travel Agent started receiving huge complaints because of this synchronous processing. They again called the architecture and proposed the problem before him.

Now architecture was really at a fix as he did not wanted to touch the booking engine logic to increase performance. So he concluded to use MSMQ (Microsoft Message Queuing) service. He analyzed that the main problem was that the travel agent had to wait until his first ticket booking is not completed. So when the travel agent makes a booking it will come and fall in the queue and release the travel agent. Booking engine will always poll for this queue. When the booking engine finishes he will publish the booking results back to the queue. Travel agent client can then come at his leisure and see the results. Again he and his team mates implemented this solution.

Every one in the travel company was really happy and impressed by the architect and his team members.

As time passed by the booking engine was serving huge ticket bookings.

Travel Agent then felt a huge necessity of a good security model with the booking engine. Again the architecture was called; he again had a kick of meeting and proposed WSE as the security solution. Implemented the same and everything was fine.

After some days travel agent wanted to start a scheme to book group family ticket bookings through the booking engine. Till now the travel agent was booking one ticket at a time. But soon he started getting lot of orders to book group family tickets. He wanted to incorporate the same in the booking engine with consistency. Consistency means if any of the ticket booking fails in the family booking all the tickets should be cancelled. In short either all the tickets in the family are booked or none of them. Looking at the need Architecture thought to use COM+ Services to manage transactions.

Architecture and his team were now feeling the pressure and heat of managing multiple technologies to achieve. The happy architecture now started becoming frustrated. His team members started slogging for night as they had to work on multiple technologies at one time.

The frustrated architecture finally went to MICROSOFT to find one solution. He was then introduced to WCF. And after implementing WCF the architecture and the team lived happily ever after.

Liked the story??

In short WCF is a unification technology which unites the following technologies:-

  • .NET remoting
  • MSMQ
  • Web services
  • COM+