Infosys Microsoft Alliance and Solutions blog

Main | October 2006 »

September 29, 2006

BizTalk as an ESB

Mohan commented on my earlier blog and asked my views on BizTalk as an Enterprise Service Bus (ESB). My take is that if we look at the functionality that ESBs are meant to provide, BizTalk does fit in pretty well, however if we look at some of the deployment considerations (like feature specific deployment), then BizTalk doesn't fit in, since we have to install the entire package. We can however, selectively enable certain funtionality by appropriate configuration.

Considering the better processing power we can get these days, I would tend to put more weightage to the features than deployment aspects. The deployment requirements might result in higher costs, but then there could be various other factors forcing organizations to anyway go in for high end servers.

Getting back to feature set, there are a few definitions of ESB out there. At a high level ESB fits in the middleware category and is primarily about intergration applications using standards based bus (messaging engine). Below, I will try and list the key features that we expect from an ESB and then see where BizTalk fits into it. This list is from wikipedia.

  • It is not an implementation of Service Oriented Architecture --> This is more of concept behind ESB and hence we need not map BizTalk to this.
  • It is usually operating system and programming language agnostic; it should enable interoperability between Java and .Net applications, for example --> BizTalk isn't OS or programming language agnostic by itself, but can help interoperate/integrate Java and .net applications via say the SOAP adapter.
  • It uses XML (eXtensible Markup Language) as the standard communication language --> Though BizTalk can work with any document type, most of features are best used when working with XML. In fact, a common myth is that it is necessary to convert all input documents to XML before sending them for processing within BizTalk.
  • It supports Web services standards --> BizTalk has SOAP adapter that helps you work with web services. It also has adapter for working with Web Services Enhancements (WSE) 2.0.
  • It supports messaging (synchronous, asynchronous, point-to-point, publish-subscribe) --> BizTalk inherantly works on pub-sub model. Messages are published into the BizTalk Message box database and orchestrations and send ports subscribe to them. BizTalk also support message routing, message translation, short and long running transactions and various other message delivery related features. Via use of specific adapters like MSMQ, asynchronous message delivery can be easily achieved.
  • It includes standards-based adapters (such as J2C/JCA) for supporting integration with legacy systems --> BizTalk has a plethora of out-of-box and third party adapters that can be used to integrate with various legacy and LOB systems. A list of such adapters is available here. BizTalk also can work closely with Host Integration Server to connect to mainframes.
  • It includes support for service orchestration & choreography --> Orchestration is one of the key features of BizTalk. BizTalk conforms to Business Process Execution Language (BPEL) standards. Not only does BizTalk provides orchestration execution features, it also has a rich designer support well integrated with Visual Studio 2005. Additionally, it has Orchesration Designer for Business Analysts (ODBA) that integrates with Visio and business users can use it to designing orchestrations.
  • It includes intelligent, content-based routing services (itinerary routing) --> BizTalk supports content based routing via promoted properties concept.
  • It includes a standardized security model to authorize, authenticate, and audit use of the ESB --> BizTalk has mechanisms in place to provide security. It can even work with Certificates and supports ability to resolve incoming requests via these certificates.
  • It includes transformation services (often via XSLT) between the format of the sending application and the receiving application, to facilitate the transformation of data formats and values --> BizTalk has extensive support for data transformation via the Mapper functionality. It provides host of funtoids out-of-box to manage the transformations and also includes ability to custom script additionaly functionality that isn't available via the functoids. For this transformation and schema creation itself, BizTalk again has great tool that integrates with VS. We don't have to worry about writing XSLT manually.
  • It includes validation against schemas for sending and receiving messages --> The pipelines in BizTalk provide mechanisms to validate messages based on published schemas.
  • It can uniformly apply business rules, enrichment of the message from other sources, splitting and combining of multiple messages, and the handling of exceptions --> BizTalk supports interchange handling (splitting messages) and also allows aggregation of messages. Via pipelines and mappers we can work with the messages and modify them. There is good business rules engine (BRE) support via which we can define rules and policies and use them in orchestrations. The policies are managed external to the orchestration and hence can be changed at any time without having to touch the orchestartions. Since BizTalk supports long running transactions, it also has mechanisms for compensating transactions.
  • It can conditionally route or transform messages based on a non-centralized policy - meaning that no central rules engine needs to be present --> Already discussed this above in terms of content based routing and mapping functionality.
  • It is monitored for various SLA (Service-Level Agreement) thresholds message latency and other characteristics described in a Service Level Agreement --> BizTalk has Business Activity Monitoring (BAM) features that provide a portal based approach to track the messages and orchestration progress. Additionally, extensive performance monitor counters are available that can be used to get additional information about message processing speeds etc.
  • It (often) facilitates "service classes," responding appropriately to higher and lower priority users --> This is managed more by appropriate deployment and configuring specific features on specific servers. 
  • It supports queuing, holding messages if applications are temporarily unavailable --> BizTalk can work with adapters like MSMQ that provide such features. It also has capabilities of setting retry count and retry intervals.
  • It is comprised of selectively deployed application adapters in a (geographically) distributed environment --> BizTalk has to be deployed in full, thought post that selective features can be enabled on the machines.

So in a nutshell, as stated earlier, from feature standpoint BTS does offers features that make it a worthy ESB.

September 26, 2006

Asynchronous Programming Model in .NET Framework 2.0 - Part III,,,

In my previous blogs “Asynchronous Programming Model in .NET Framework 2.0 Part I and Part II, I had explained the basics of EBAPM and about various approaches to call an operation in a separate thread. In this final sequel to those blogs, I am going to explain how an operation should be designed so that it would be invoked asynchronously based on EBAPM. It is better to recollect that EBAPM provides more flexibility to an asynchronous operation. EBAPM provides flexibility in canceling an ongoing asynchronous operation. It also supports retrieving incremental result and status from an asynchronous operation. Apart from those, it is possible to invoke the same operation more than once asynchronously if application logic requires that.

 

To explain how to code an operation to provide such flexibilities, I have created a simple application that retrieves the private data such as address, credit card history, employment details, medical history and travel details of a person based on the unique identification of person such as SSN.

However, as this SpyHard application is just to show the capabilities of EBAPM and I am not aware of the central repository wherein I can retrieve all such private data, I have used Thread.Sleep() so liberally in my coding as a substitute to implementing that logicSmile. And it also does not have logic to do the name resolution from supplied SSN so you will get to see the same hard coded data of mine for any SSN even if there is no SSN (So, don’t try to get the private details of your friends and foes through this applicationSmile). So, This SpyHard application is as dumb and clumsy as the hero (my favorite comedian – Leslie Nielsen) of the “SpyHard” movie which is a great spoof on many other adrenalin pumping action movies. But what we are interested in this code, is to know, if our application needs to implement an operation that is time consuming one, how to implement that based on EBAPM, so that client can invoke it asynchronously and get the incremental details about the operation easily. For that purpose, I have developed a bit contrived operation that retrieves private details of a person, in a time consuming fashion. This operation is also contrived to provide increment result such as name, address, credit card details etc and increment status such as the percentage of completed work.

We need following constructs in order to create an asynchronous operation for BackgroundCheck information retrieval.

BackgroundCheckAsync method

This method implements the logic to help invoking it asynchronously. Two things to be noted in this method are the second parameter – taskId and AsyncOperation class. While this method takes SSN as the first parameter, some unique id needs to be passed as another parameter that helps EBAPM to invoke this method multiple times asynchronously from client side.  AsyncOperation class is one that represents and keeping track of life time of each asynchronous operation that is distinguished by the unique id that I mentioned above.  AsyncOperation object for each asynchronous operation should be stored in the HybridDictionary to ensure that this asynchronous operation should not be invoked more than once with the same unique id. AsyncOperation provides two methods Post and PostOperationCompleted methods that are key methods to inform details such as increment result as well as progress and completion of execution of asynchronous operation, to client applications. These two methods will be invoked within an asynchronous operation. The Post method is to inform the client about the intermediate result and progress of the operation. Basically, this Post method triggers an event, to which, clients will be subscribing to, to get the notification. The PostOperationCompleted method is to inform the client about the completion of execution of asynchronous operation, by triggering an event from within asynchronous operation. The events to be triggered by both Post and PostOperationCompleted methods of AsyncOperation are wrapped inside a delegate of type SendOrPostCallback in System.Threading namespace. You should also notice that, the business logic of this method, has been wrapped up in another private method – RetrieveBackgroundCheckInfo that invokes Post and PostOperationCompleted methods appropriately within it. This private method will be invoked asynchronously in BackgroundCheckAsync method through BeginInvoke of a delegate that represents RetrieveBackgroundCheckInfo method.

BackgroundCheckAsyncCancel method

This method helps to cancel the execution of BackgroundCheckAsync method. It does nothing but removing the AsyncOperation object that keeps track of the life time of the asynchronous operation from HybridDictionary collection.

BackgroundCheckCompleted event

Client application will subscribe to this event to get notification on the completion of asynchronous operation. This is an event, which gets triggered by PostOperationCompleted method of AsyncOperation object within the asynchronous method implementation.

BackgroundCheckProgressChanged event

Client application will subscribe to this event to get increments result value and status of ongoing asynchronous operation. This is an event, which gets triggered by Post method of AsyncOperation object within the asynchronous method implementation.

BackgroundCheckCompletedEventArgs class

This class is derived from “AsyncCompletedEventArgs” class of System.ComponentModel namespace. This class represents the result of the BackgroundCheckAsync method.

BackgroundCheckProgressChangedEventArgs class

This class is derived from “”ProgressChangedEventArgs” class of System.ComponentModel namespace. This class represents the percentage of completion of an asynchronous operation.

BackgroundCheckCompletedEventHandler delegate

It provides the method signature of a delegate that needs to be bound with BackgroundCheckCompleted event at client application.

BackgroundCheckProgressChangedEventHandler delegate

It provides the method signature of a delegate that needs to be bound with PrivateDetailProgressChanged event at client application.

I know that it may seem to be bit of too much to be grasped at one take, as these have been explained in bits and pieces. Seeing the complete code that is given below will provide better context and understanding of all above items.

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Threading;
using System.Collections.Specialized;
namespace SpyHardLibrary
{
    public class SpyHard
    {
        private HybridDictionary userStateToLifetime = new HybridDictionary();
        private delegate void WorkerHandler(string ssn, AsyncOperation asyncOp);
        public delegate void BackgroundCheckCompletedEventHandler(object sender, BackgroundCheckCompletedEventArgs e);
        public delegate void BackgroundCheckProgressChangedEventHandler(BackgroundCheckProgressChangedEventArgs e);
        public event BackgroundCheckCompletedEventHandler BackgroundCheckCompleted;
        public event BackgroundCheckProgressChangedEventHandler BackgroundCheckProgressChanged;
        private SendOrPostCallback onProgressReportDelegate;
        private SendOrPostCallback onCompletedDelegate;
        public SpyHard()
        {
            onCompletedDelegate = new SendOrPostCallback(BackgroundCheckFunctionCompleted);
            onProgressReportDelegate = new SendOrPostCallback(BackgroundCheckReportProgress);
        }
        private void BackgroundCheckFunctionCompleted(object state)
        {
            BackgroundCheckCompletedEventArgs e = state as BackgroundCheckCompletedEventArgs;
            OnBackgroundCheckCompleted(e);
        }
        private void BackgroundCheckReportProgress(object state)
        {
            BackgroundCheckProgressChangedEventArgs e = state as BackgroundCheckProgressChangedEventArgs;
            OnBackgroundCheckProgressChanged(e);
        }
        protected void OnBackgroundCheckCompleted(BackgroundCheckCompletedEventArgs e)
        {
            if (BackgroundCheckCompleted != null)
            {
                BackgroundCheckCompleted(this, e);
            }
        }
        protected void OnBackgroundCheckProgressChanged(BackgroundCheckProgressChangedEventArgs e)
        {
            if (BackgroundCheckProgressChanged != null)
            {
                BackgroundCheckProgressChanged(e);
            }
        }
     
        public void BackgroundCheck(string ssn, ref string nameDetails, ref string addressDetails, ref string ccDetails, ref string employmentDetails, ref string healthDetails, ref string travelDetails)
        {
            string strName = string.Empty;
            string strAddress = string.Empty;
            string strCCHistory = string.Empty;
            string strEmploymentHistory = string.Empty;
            string strHealthHistory = string.Empty;
            string strTravelHistory = string.Empty;
            //logic to retrieve Name
            Thread.Sleep(10000);
            strName = "Ganesan Krishnamurthy";
           
            //logic to retrieve Address
            Thread.Sleep(10000);
            strAddress = "Infosys Technologies Limited, Bangalore, India";
          
            //logic to retrieve Credit Card Details
            Thread.Sleep(10000);
            strCCHistory = "Not So Bad!!!";
            //logic to retrieve Employment Details
            Thread.Sleep(10000);
            strEmploymentHistory = "12+ years of IT experience";
            //logic to retrieve Health Details
            Thread.Sleep(10000);
            strHealthHistory = "Robust";
            //logic to retrieve Travel History
            Thread.Sleep(10000);
            strTravelHistory = "Had been to Melbourne, Australia in 2005";
            nameDetails = strName;
            addressDetails = strAddress;
            ccDetails = strCCHistory;
            employmentDetails = strEmploymentHistory;
            healthDetails = strHealthHistory;
            travelDetails = strTravelHistory;
        }
        public void BackgroundCheckAsync(string ssn, object taskId)
        {
            AsyncOperation asyncOp = AsyncOperationManager.CreateOperation(taskId);
            lock (userStateToLifetime.SyncRoot)
            {
                if (userStateToLifetime.Contains(taskId))
                {
                    throw new Exception("taskId is already existing!!!");
                }
                else
                {
                    userStateToLifetime[taskId] = asyncOp;
                }
            }
            WorkerHandler workerHandler = new WorkerHandler(RetrieveBackgroundCheckInfo);
            workerHandler.BeginInvoke(ssn, asyncOp, null, null);
        }
        public void BackgroundCheckAsyncCancel(object taskId)
        {
            AsyncOperation asyncOp = userStateToLifetime[taskId] as AsyncOperation;
            if (asyncOp != null)
            {
                lock (userStateToLifetime)
                {
                    userStateToLifetime.Remove(taskId);
                }
            }
           
        }
        private void RetrieveBackgroundCheckInfo(string ssn, AsyncOperation asyncOp)
        {
            ProgressChangedEventArgs pceArgs = null;
            string strName = string.Empty;
            string strAddress = string.Empty;
            string strCCHistory = string.Empty;
            string strEmploymentHistory = string.Empty;
            string strHealthHistory = string.Empty;
            string strTravelHistory = string.Empty;
            pceArgs = new BackgroundCheckProgressChangedEventArgs("", 5, asyncOp.UserSuppliedState);
            asyncOp.Post(onProgressReportDelegate, pceArgs);
            //logic to retrieve Name
            Thread.Sleep(10000);
            strName = "Ganesan Krishnamurthy";
            pceArgs = new BackgroundCheckProgressChangedEventArgs(strName, 15, asyncOp.UserSuppliedState);
            asyncOp.Post(onProgressReportDelegate, pceArgs);
            //logic to retrieve Address
            Thread.Sleep(10000);
            strAddress = "Infosys Technologies Limited, Bangalore, India";
            pceArgs = new BackgroundCheckProgressChangedEventArgs(strAddress, 30, asyncOp.UserSuppliedState);
            asyncOp.Post(onProgressReportDelegate, pceArgs);
            //logic to retrieve Credit Card Details
            Thread.Sleep(10000);
            strCCHistory = "Not So Bad!!!";
            pceArgs = new BackgroundCheckProgressChangedEventArgs(strCCHistory, 45, asyncOp.UserSuppliedState);
            asyncOp.Post(onProgressReportDelegate, pceArgs);
            //logic to retrieve Employment Details
            Thread.Sleep(10000);
            strEmploymentHistory = "12+ years of IT experience";
            pceArgs = new BackgroundCheckProgressChangedEventArgs(strEmploymentHistory, 60, asyncOp.UserSuppliedState);
            asyncOp.Post(onProgressReportDelegate, pceArgs);
            //logic to retrieve Health Details
            Thread.Sleep(10000);
            strHealthHistory = "Robust";
            pceArgs = new BackgroundCheckProgressChangedEventArgs(strHealthHistory, 75, asyncOp.UserSuppliedState);
            asyncOp.Post(onProgressReportDelegate, pceArgs);
            //logic to retrieve Travel Details
            Thread.Sleep(10000);
            strTravelHistory = "Had been to Melbourne, Australia in 2005";
            pceArgs = new BackgroundCheckProgressChangedEventArgs(strTravelHistory, 100, asyncOp.UserSuppliedState);
            asyncOp.Post(onProgressReportDelegate, pceArgs);
            Exception error = null;
            bool cancelled = false;
            object userState = asyncOp.UserSuppliedState;
            BackgroundCheckCompletedEventArgs pdceArgs = new BackgroundCheckCompletedEventArgs(strName, strAddress, strCCHistory, strEmploymentHistory, strHealthHistory, strTravelHistory, error, cancelled, userState);
            asyncOp.PostOperationCompleted(onCompletedDelegate, pdceArgs);
        }
    }
    public class BackgroundCheckCompletedEventArgs : AsyncCompletedEventArgs
    {
        private string strNameValue = string.Empty;
        private string strAddressValue = string.Empty;
        private string strCCHistoryValue = string.Empty;
        private string strEmploymentHistoryValue = string.Empty;
        private string strHealthHistoryValue = string.Empty;
        private string strTravelHistoryValue = string.Empty;
        public BackgroundCheckCompletedEventArgs(string strName, string strAddress, string strCCHistory, string strEmploymentHistory, string strHealthHistory, string strTravelHistory, Exception error, bool cancelled, object userState)
            : base(error, cancelled, userState)
        {
            this.strNameValue = strName;
            this.strAddressValue = strAddress;
            this.strCCHistoryValue = strCCHistory;
            this.strEmploymentHistoryValue = strEmploymentHistory;
            this.strHealthHistoryValue = strHealthHistory;
            this.strTravelHistoryValue = strTravelHistory;
        }
        public string NameDetails
        {
            get
            {
                return strNameValue;
            }
        }
        public string AddressDetails
        {
            get
            {
                return strAddressValue;
            }
        }
        public string CCHistoryDetails
        {
            get
            {
                return strCCHistoryValue;
            }
        }
        public string EmploymentHistoryDetails
        {
            get
            {
                return strEmploymentHistoryValue;
            }
        }
        public string HealthHistoryDetails
        {
            get
            {
                return strHealthHistoryValue;
            }
        }
        public string TravelHistoryDetails
        {
            get
            {
                return strTravelHistoryValue;
            }
        }
    }
    public class BackgroundCheckProgressChangedEventArgs : ProgressChangedEventArgs
    {
        private string strDetailsValue = string.Empty;
        public BackgroundCheckProgressChangedEventArgs(string strDetails, int progressPercentage, object userState)
            : base(progressPercentage, userState)
        {
            this.strDetailsValue += strDetails;
        }
        public string DetailsValue
        {
            get
            {
                return strDetailsValue;
            }
        }
    }
   
}

Though it is bit tedious to implement such asynchronous operation supporting classes, outcome of high flexibility because of this model, really outweighs the effort taken to implement this class. To understand this point better, I have implemented the following windows form application that consumes the above class – its asynchronous operation.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SpyHardLibrary;
namespace SpyHardWinApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            SpyHard spyHard = new SpyHard();
            spyHard.BackgroundCheckProgressChanged += delegate(BackgroundCheckProgressChangedEventArgs pdpceArgs)
            {
                progressBar1.Value = pdpceArgs.ProgressPercentage;
                if(string.IsNullOrEmpty(textBoxName.Text)){
                    textBoxName.Text = pdpceArgs.DetailsValue;
                }
                else if(string.IsNullOrEmpty(textBoxAddress.Text)){
                    textBoxAddress.Text = pdpceArgs.DetailsValue;
                }
                else if (string.IsNullOrEmpty(textBoxCCHistory.Text))
                {
                    textBoxCCHistory.Text = pdpceArgs.DetailsValue;
                }
                else if (string.IsNullOrEmpty(textBoxEmploymentHistory.Text))
                {
                     textBoxEmploymentHistory.Text = pdpceArgs.DetailsValue;
                }
                else if (string.IsNullOrEmpty(textBoxHealthHistory.Text))
                {
                    textBoxHealthHistory.Text = pdpceArgs.DetailsValue;
                }
                else
                {
                    textBoxTravelHistory.Text = pdpceArgs.DetailsValue;
                }
            };
            spyHard.BackgroundCheckCompleted += delegate(object sender1, BackgroundCheckCompletedEventArgs pdceArgs)
            {
                textBoxStatus.Text = "Operation Completed!!!";
            };
            spyHard.BackgroundCheckAsync(textBoxSSN.Text, "1");
        }
       
    }
}

The UI of the application will look like as given below after the execution of the asynchronous operation BackgroundCheckAsync.

SpyHard Application UI image

I hope this sample code in this and in my previous blogs on Asynchronous Programming model throw enough light on the concepts behind event based asynchronous programming model and various approaches in .NET Framework 2.0 to invoke an operation in a separate thread, for understanding the asynchronous model that is very essential to develop better performance as well as better UI experience applications.

Vista Performance Booster

This is one really cool feature I came across in Vista. If you wonder, how you would upgrade the memory in your Laptop to serve up the hunger of Vista, you have better things to do than buying up a 1GB memory for $300 and panting with it.

Windows Vista introduces a new concept in adding memory to a system. Windows ReadyBoost lets you use a conventaional USB-based flash memory device, such as a USB thumb drive, to improve system performance without actually upgrading the memory. Called as Windows ReadyBoost, this technology improves performance because it can retrieve data kept on the flash memory more quickly than it can retrieve data kept on the hard disk, decreasing the time needed to wait for PC to respond.

I have tried extending a laptop with 1GB of RAM using a 2GB fast USB thumb drive and the performance really took off. This is certainly something to think about for all you laptop users out there that are considering running Windows Vista.

Troubleshooting BizTalk Applications

Microsoft recently published a pretty exhaustive guide for developers working with BizTalk 2006. It has information on best practices to build a BizTalk application and contains lot of troubleshooting tips. A must have for every BizTalk developer. Get the guide here.

September 21, 2006

Asynchronous Programming Model in .NET Framework 2.0 - Part II,,,

Let us continue from where we left off in “Asynchronous Programming Model in .NET Framework 2.0 – Part I”. But, in this blog, instead of delving deep into EBAPM implementation details, I will step into various ways to achieve asynchronous invocation of method calls, in .NET Framework 2.0. That will give us better perspective of Asynchronous programming model. Asynchronous programming model can be simplistically defined as invoking methods in separate threads from main UI or primary threads.

 

.NET, being a rich framework, it provides more than one option to achieve it. In fact, a few options that we may be familiar with, even without knowing that they invoke methods in different threads than the main ones.

 

Asynchronous invocation is possible through the following approaches, apart from the ones that we have seen in my previous blog,

  1. through QueueUserWorkItem method of ThreadPool class
  2. through an explicitly created thread
  3. through Timer class
  4. through BackgroundWorker class

Out of these, BackgroundWorker class is new to .NET Framework and it has been introduced in .NET Framework 2.0. While the approaches are more or less the same in invocation part, new asynchronous features in .NET Framework 2.0 such as EBAPM, BackgroundWorker class provide more flexibility in terms of canceling the ongoing asynchronous operations and getting the incremental status of background running operations so that progress bar updates is possible at UI side.

I have created code snippets for all these approaches in the following windows form application that will have the UI as given below.

Asynchronous Invocations in .NET Fwk 2.0 

And I have invoked the following very primitive Web Service in that windows Form application.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace BackgroundWorkerWinApp
{
    public partial class Form1 : Form
    {
        BackgroundWorker bgw;
        BackgroundWorkerWinAppWS.BackgroundWorkerWinAppWS proxy;
       
        public Form1()
        {
            InitializeComponent();
            proxy = new BackgroundWorkerWinAppWS.BackgroundWorkerWinAppWS();
            #region Asynchrouns invocation through WS Proxy - event binding
            proxy.HelloWorldCompleted += delegate(object sender, BackgroundWorkerWinAppWS.HelloWorldCompletedEventArgs e)
            {
                textBoxStatus.Text = e.Result.ToString();
                textBoxStatus.BackColor = Color.Gray;
            };
            #endregion
            #region Asynchronous invocation through BackgroundWorker - event binding
            bgw = new BackgroundWorker();
            bgw.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                textBoxStatus.Text = proxy.HelloWorld();
                textBoxStatus.BackColor = Color.Green;
            };
            #endregion
        }
        #region Synchronous invocation of Web Service
        private void btnInvokeWebService_Click(object sender, EventArgs e)
        {
            textBoxStatus.Text = proxy.HelloWorld();
            textBoxStatus.BackColor = Color.Blue;
        }
        #endregion
        #region Asynchronous invocation through BackgroundWorker class
        private void btnInvokeWebServiceThroughBGW_Click(object sender, EventArgs e)
        {
           bgw.RunWorkerAsync();
        }
        #endregion
        #region Asynchronous invocation through Web Service proxy
        private void btnInvokeWSAsyncThroughWSProxy_Click(object sender, EventArgs e)
        {
            proxy.HelloWorldAsync();
        }
        #endregion
       
        #region Asynchronous Invocation through QueueUserWorkItem
        private void QueueUserWorkItemWSInvocation(object state)
        {
            textBoxStatus.Text = proxy.HelloWorld();
            textBoxStatus.BackColor = Color.GreenYellow;
        }
        private void btnInvokeWSAsyncThroughQueueUserWorkitem_Click(object sender, EventArgs e)
        {
            ThreadPool.QueueUserWorkItem(new WaitCallback(QueueUserWorkItemWSInvocation));
        }
        #endregion
        #region Asynchronous invocation through custom thread
        private void ThreadStartWSInvocation()
        {
            textBoxStatus.Text = proxy.HelloWorld();
            textBoxStatus.BackColor = Color.Honeydew;
        }
       
        private void btnInvokeWSAsyncThroughCustomThread_Click(object sender, EventArgs e)
        {
            ThreadStart threadStart = new ThreadStart(ThreadStartWSInvocation);
            Thread thread = new Thread(threadStart);
            //Thread, by default, behaves like a foreground thread
            //thread.IsBackground = true;
            thread.Start();
        }
        #endregion
        #region Asynchronous invocation through Timer
        private void TimerBasedWSInvocation(object state)
        {
            textBoxStatus.Text = proxy.HelloWorld();
            textBoxStatus.BackColor = Color.Indigo;
        }
        private void btnInvokeWSAsyncThroughTimer_Click(object sender, EventArgs e)
        {
            System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(TimerBasedWSInvocation));
            timer.Change(0, Timeout.Infinite);
        }
        #endregion
    }
}
 

Now, Let us go through the details of each approach.

Asynchronous invocation through QueueUserWorkItem.

The primary reason to use QueueUserWorkItem method of ThreadPool class is to invoke a method asynchronously using an available thread from CLR thread pool. In .NET Fwk 1.x, it is the recommended one for invoking an operation asynchronously. The following code snippet shows how to use QueueUserWorkItem method.

ThreadPool.QueueUserWorkItem(new WaitCallback(QueueUserWorkItemWSInvocation));

And WaitCallback delegate in our code, given below, invokes the web service synchronously.

private void QueueUserWorkItemWSInvocation(object state)
{
      textBoxStatus.Text = proxy.HelloWorld();
}
 

Asynchronous invocation through an explicit thread.

Though the usage of QueueUserWorkItem is highly preferred, we still need to invoke operations by a thread that is created explicitly by us, when we need to have some control on the thread that executes the operation. For instance, when we use a thread pool thread, we have no control over the type of thread (whether it is a foreground or background thread), priority of thread and apartment state of the thread (by default, CLR threads are set to MTA). And another important reason to go for explicit thread creation is that we may not want to tie up a thread from common thread pool for a very long running operation, because threadpool will be shared across applications. When we need to exert control on any of the above mentiones ones, we have to resort to creating an explicit thread.

The following is the delegate that is required to be passed as a parameter into ThreadStart class which is required to create a thread.

private void ThreadStartWSInvocation()
{
        textBoxStatus.Text = proxy.HelloWorld();
}
    
  
private void btnInvokeWSAsyncThroughCustomThread_Click(object sender, EventArgs e)
{
         ThreadStart threadStart = new ThreadStart(ThreadStartWSInvocation);
         Thread thread = new Thread(threadStart);           
         thread.Start();
}

Asynchronous invocation through Timer.

There is another way to invoke an operation in a separate thread, is by using a timer class. You might know that there are timer classes in three different namespaces.    

  1. Timer class in System.Threading namespace
  2. Timer class in System.Windows.Forms namespace
  3. Timer class in System.Timers namespace

Essentially, a timer is to execute an operation periodically in background using a separate thread. The purpose of existence of each one of them is distinct. The best explanation that I have read for each of them is from “CLR via C# - Applied Microsoft .NET Framework Programming” by Jeffrey Richter. According to that book, System.Windows.Forms.Timer associates the timer with the calling thread, and thus ensures that an operation is invoked through that timer in the same thread (main UI thread) that created the timer. System.Timers.Timer is a wrapper over System.Threading.Timer and this timer is specially designed to be used in design surface of windows form applications. And out of these three, System.Threading.Timer is the recommended one to invoke an operation in background periodically. So, I have used System.Threading.Timer in my code snippet as given below.

The following delegate invokes web service in synchronous manner.

private void TimerBasedWSInvocation(object state)
{
        textBoxStatus.Text = proxy.HelloWorld();
}

The following method shows how to use the timer to invoke the above delegate.

It is to be noted that first parameter of change() method is to denote how soon, from the time of invocation of timer, the method needs to be executed (here, 0 means immediately) and second parameter is to denote, how frequently the operation needs to be executed repeatedly (Timeout.Infinite means the operation is to be executed only once).

private void btnInvokeWSAsyncThroughTimer_Click(object sender, EventArgs e)
{
        System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(TimerBasedWSInvocation));
        timer.Change(0, Timeout.Infinite);
}

Asynchronous invocation through BackgroundWorker class.

BackgroundWorker class is introduced in .NET Framework 2.0, mainly, to invoke long running operations in Windows form applications, without worrying about using a delegate in callback method (to switch over to main UI thread from worker thread, as happened in Begin/End<Method> approach) in order to update the UI controls. As I had mentioned earlier, it is more flexible and powerful than .NET Fwk 1.x approaches, as it supports canceling as well as retrieving the incremental status about the ongoing asynchronous operations. To make the examples simple, I have not coded for those features here.

The BackgroundWorker class is instantiated and a delegate that is going to call web service synchronously is linked to a predefined event “DoWork” of BackgroundWorker object. The code snippet is given below.

BackgroundWorker bgw = new BackgroundWorker();
bgw.DoWork += delegate(object sender, DoWorkEventArgs e)
{
      textBoxStatus.Text = proxy.HelloWorld();              
};

private void btnInvokeWebServiceThroughBGW_Click(object sender, EventArgs e)
{
      bgw.RunWorkerAsync();
}

Having seen those different approaches to call an operation asynchronously, let us move to the implementation details of EBAPM in my next blog. But, an interesting thing that we have to understand with related to the type of thread (foreground or background) is the process will be terminated only after the completion of execution of all foreground threads in it. For example, when we create an explicit thread, it will be created as a foreground thread by default. It means, process will not be torn down till the operation executed by this thread is completed. But an explicitly created thread can be set to be a background thread, by setting that thread’s property - IsBackground to true. I tested this code to know how threads in other approaches behave with respect to the termination of application. What I did was, I executed this windows form application along with Windows Task Manager. I clicked on either one of the buttons in the UI and immediately close down the application. Then I checked how long it takes for the application instance to disappear in the windows task manager. What I have noticed is only explicitly created thread is a foreground thread and all other approaches utilize background threads. Then I set the explicitly created thread to be background thread by setting IsBackground to true and repeated the experiment. Yes, now process got terminated immediately once I shut down the application.

 

 

September 19, 2006

Asynchronous Programming Model in .NET Framework 2.0 - Part I,,,

One of my favorite features in my book “101 reasons to go for .NET Framework 2.0” is Event based asynchronous mechanism. I had mentioned that asynchronous mechanism in .NET Framework 2.0 is more based on events rather than relying on delegates. We all know that event and delegate are distinct ones but differences between them are very subtle as one depends on another.

 

Events are basically to trigger a special occurrence in an application, and these special occurrences should be notified to subscribers who are interested in them. In subscribers’ side, invariably the delegates (if loosely defined, managed functional pointers) are being used to bind callback methods to these events. Thus, implementation of event based programming depends on both events and delegates. Asynchronous programming model is one that requires this event/delegate mechanism.

.NET Framework 1.x makes it easy to invoke any synchronous method in asynchronous manner, through internal creation the asynchronous method invocation mechanisms for them, by default. The widely used asynchronous pattern, through Begin<MethodName> and End<MethodName>, heavily depends on delegates. Once you used to the intricacies of this asynchronous model such as IAsyncResult, AsyncCallback and how to retrieve the result from within callback methods through End<MethodName> by passing IAsyncResult object (that is returned by Begin<MethodName> ) as a parameter into that method, you might start liking its simplicity. However, you might also have felt that this simple mechanism can be made simpler by letting the developers not to deal with certain threading related aspects such as waiting for a signal from the worker thread to proceed further in main thread or not to deal with bit of tedious coding practice to retrieve the result by invoking the mandatory End<MethodName>. (You might also aware of dreadful consequences of not invoking End<MethodName> ). New event based asynchronous programming model (if you are an acronymphil, start using catchy EBAPM now onwardsSmile) in .NET Framework 2.0, makes asynchronous programming simpler by abstracting out those above mentioned nagging points. And it also provides better support to invoke same asynchronous calls multiple times (looking back at DBAPM – delegates based asynchronous programming mode – another tidbit to acronymphils – it is tedious to do that as you have to pass appropriate and specific IAsyncResult objects of Begin<MethodName> into End<MethodName> methods), to cancel as well as to get the incremental status on the ongoing async operation.

In .NET Framework 2.0, to invoke methods of components are based on this EBAPM model, asynchronously, you no longer require invoking the famous pair of Begin and EndInvoke methods. Instead, you will invoke <MethodName>Async().No more dealing with that nice interface “IAsyncResult”. Retrieving the result from the asynchronously invoked method is also not through the invocation of End<MethodName> .  To be brief, developer need not bother too much about the threading aspects involved in asynchronous programming model. Though asynchronous invocation is so easy and clutter-free, implementing asynchronous mechanism into your component or class requires thorough understanding of new EBAPM concepts and newly introduced classes such as AsyncOperation, AsyncOperationManager, etc. I will provide details on them in my subsequent blogs.

However, before we delve deep into those concepts, we have to see how easy it would be to invoke the methods of components that are based on new EBAPM. And ASP.NET Web Service in .NET Framework 2.0 is one of such components. What it means is, don’t get surprised not to see those Begin and End methods syntax in the web service proxy. Instead you would see a method “<MethodName>Async” and an event “<MethodName>Completed”.

So, let us build a simple web service in .NET Framework. The following is the code snippet of that simple web service.

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Threading;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class OrderProcessingWebService : System.Web.Services.WebService
{
    public OrderProcessingWebService () {
       
    }
    [WebMethod]
    public string ProcessAnOrder() {
        Thread.Sleep(10000);
        return "Order Processed!!!";
    }
   
}

Now, let us build a windows form application that consumes this web service. You have to use “Add Web References” to create the proxy for the web service.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace MyAsyncWebServiceWindowApp
{
    public partial class Form1 : Form
    {
        OrderProcessingWS.OrderProcessingWebService proxy = null;
        public Form1()
        {
            InitializeComponent();
            proxy = new OrderProcessingWS.OrderProcessingWebService();
            proxy.ProcessAnOrderCompleted += delegate(object sender,  OrderProcessingWS.ProcessAnOrderCompletedEventArgs e)
            {
                  callbackThreadTextBox.Text = Thread.CurrentThread.ManagedThreadId.ToString();
                  statusTextBox.Text = e.Result.ToString();
            };          
        }
       
        private void button1_Click(object sender, EventArgs e)
        {
            uiThreadTextBox.Text = Thread.CurrentThread.ManagedThreadId.ToString();
            statusTextBox.Text = "Order is to be processed, asynchronously!!!";
            proxy.ProcessAnOrderAsync();
        }
    }
}

Now, you can compare this approach with previous one in .NET Framework 1.x. If you liked the previous asynchronous model very much, you would miss things such as Begin and End Methods, IAsyncResult interface and dealing with WaitHandle, but you would not deny that this approach is more intuitive and clutter-free. And you would also have noticed in the above code, that one tiny but a neat feature in .NET Framework 2.0, anonymous method, eliminates the necessity of creating a separate method to be linked with a delegate in event binding.

And another important thing that you would have noticed is that you need not worry about using delegate to switch over from worker thread to main UI thread, when you try to update the UI controls from within callback method, in this approach, as you have to do in DBAPM in .NET Framework 1.x in Win Form applications.

In my next blog, let us see more conceptual and technical details of EBAPM. Hope we would say good bye to DBAPM soon Smile.

Extending the reasons to go for .NET Framework 2.0,,,

While I could definitely say that I really enjoyed writing the book “101 reasons to go for .NET Framework 2.0”, I would also like to say that more technical details should have been provided at each feature level. For example, when I mentioned that GC has been enhanced to handle unmanaged memory, in better way, I really wanted to provide more information on internals of GC such as its generation based collection mechanisms, finalization list, freachable queue; issues associated with finalize method and weak reference types etc.

 

This is true not only for GC but also for many of my favorite features such as new code behind model, Threading, Asynchronous programming, Transaction model and various other security related features. However, the aim of the book is not to make it in-depth one (and who can successfully compete with the ilk of Jeffrey Richter and Don Box in explaining the .NET Framework so lucidly!!!) but to provide compilation of interesting features with some background information to architects, development and business users community so that they can decide whether to go for .NET Framework 2.0 or not. Because of that, some of features may seem bit sketchy in their explanation, in that book. I would like to take on such features in a series of blogs on .NET Framework 2.0 along with .NET Framework 3.0 related blogs.  So, be tuned to those blogs and let me know your feedbacks.

September 18, 2006

BizTalk 2006 Documentation

Download the latest BizTalk 2006 documentation (published on 13 Sept 2006) from http://www.microsoft.com/downloads/details.aspx?FamilyID=3294ddaf-9f67-409f-a92d-2f6070dc0d1a&displaylang=en

September 16, 2006

Database Migration

Database Migration Solutions  team of SI consists of folks with rich experience in database industry working geographically across  various locations providing end-to-end Migration, Upgrade and Consolidation solutions for various databases . This is done with reduced downtime, well-managed change of environment using industry best practices, knowledge base, Predictability and Global Delivery Model to our Clients.

We have been working on heterogeneous/homogeneous database migrations across different platforms and have certified professionals having specialized skillset on SQL Server migrations .

Some of our key-value differentiators in providing solutions are:

In-house tools and methodologies developed for database migration
Database Migration Centre Of Excellence
Certified Database Administrators with migration expertise
Support from Alliance partners like Microsoft, Oracle, IBM etc


Going forward we would be sharing our learning’s which we gathered while executing migration projects.

 

 

September 15, 2006

Document your BizTalk Installation

I recently downloaded the UK SDC BizTalk 2006 Documenter and ran it on my local BizTalk installation. The output CHM is amazing and captures quite a bit of information.

The good part is that it is able to provide details like maps, schemas, variables, messages, ports etc within an orchestration. This helps when you have multiple orchestrations within a single application, since the BizTalk Admin console groups only at application level and not at individual orchestration level inside it.

A few minor issues however were

  1. It didn't document all the policies. I ran it a couple of times and it picked only 1 policy. It did list all the vocabularies though.
  2. Path for output file set in Output options screen isn't saved and restarting the exe resets this back to the default.
  3. It worked well with local BizTalk installation. For remote machines I got "object reference not set to an instance of an object" error. This could be due to the fact that the tool tries to loads the assemblies listed in the bts_assembly table in the BizTalkMgmtDb. It will not document in detail if it fails to load these (via GAC).

Overall, this is a great tool to have handy

Undocumented Code Access Security change in .NET 2.0

I was attempting to deploy a simple Windows Application by publishing it over the Web. While it worked in its plain-vanilla form, it started behaving awkwardly after I had a number of Enterprise Library components with its related config stuff going into the App.Config file. After much toil, I finally discovered the reason behind it, which actually seems to be a security-enhancing mechanism whose workaround seems to have gone undocumented in MSDN.

Now, its something like this. During the days of .NET 1.1, an application could load the configuration nodes in App.Config or Web.Config (the section providers) under Medium Trust. Come .NET 2.0, and the Code Access level permissions required to load the various configuration settings of the config file are extended.

In the new way, Medium Trust checks a requirePermission attribute on the configuration section declaration - the section at the top of your config file.  For example,

<section name="exceptionManagement" requirePermission="false" type="MyNamespace.MyExceptionHandler, ExceptionManager"  />
<section name="logger" requirePermission="true" type="MyNamespace.MyLogger, Logger"/>

If they are declared as above then access to the "exceptionManagement" provider section is allowed but access to the "logger" section is not (under Medium Trust). By default, requirePermission is set to true, and we need to explicitly add the requirePermission="false" attribute to the element. And in the case of click-once deployment that made me stumble on this, I had to add this additional piece in App.Config to get it all going.

<system.web>                                                                                                                                                  

<trust level="Medium" originUrl=""/>                                                                                                                    </system.web>

And this thing about requirePermission doesn’t seem to be a documented fact and in fact if you add the attribute to the section element of your config file, intellisense tells you it is not a valid attribute for the element. But then, that's the way it works!

September 14, 2006

Blog Ahoy!

What do you get when you make an Obsessive Compulsive Blogger bloke sit up and blog over his second major passion? – You’ll find him tooting his way all around here!

Here’s welcoming you into the esoteric world of the genuine geek. Well, I’m a Senior Technical Specialist at Microsoft Technology Center here at Infosys. And when I’m not dabbling with .NET 3.0 (the erstwhile WinFx) or playing around with Software Factories or coding queer algorithms or developing mystical  frameworks that relieve you of your otherwise mundane programming, you’ll find me blogging as though there was no tomorrow.

In my spaces you'll read all about what's hot and what's not in the .NET world, analysis of technical tit-bits, reviews of new Microsot products and technologies and much more... Keep checking out these spaces for an exciting blogpourri of Microsoft Technologies.

Handle 100 million users on website

A very interesting article on how MySpace.com built their infrastructure to support 100 million users. Read here.

September 13, 2006

TFS talking to other Databases

Can TFS talk to other databases from its Application Layer Web Services?

Well the answer to this question is Yes and No Smile. “No” because the TFS Application Layer Web Services are tightly coupled to TFS Database and there is little scope for us to do any modifications there. “Yes” because there is a work around for this, of course with its own set of issues.

So what is the work around we have?..............

The extensibility option of TFS comes handy here. Whenever there is an update to the TFS Database, Notification Events are raised. There are close to a dozen of such events to which subscribers can subscribe to (more details on how to subscribe can be found in the MSDN documentation), like in this case one can subscribe to WorkItemChangedEvent. TFS also provides a standard Event Handler called Notify which takes in eventXml as parameter. This is the xml representation of the change that has happened in the TFS database. E.g. if a work item is added to the TFS database, then this xml will have all the data of the item that has been created. This data can be extracted from the xml and then updated to the external database accordingly in the event handler.

Of course, this may not be an elegant solution, however for people who want to capture this data in a different database for what ever reason; this is the only possible approach

Thanks and Regards

PrashanthG

September 12, 2006

Legacy Modernization Assessment

In my experience, the sales cycle in Legacy Modernization (LM) programs is a challenge. A transformational LM program is a major investment for the business and in some sense it is a leap of faith to move from the time-tested big iron to nimbler and (more importantly) cheaper technology platforms. The business decision to go ahead is bold and risky as it has to override the opinion of some within the IT community who are staunch mainframe aficionados. The big blue hasn't had too many trysts with the blue screen of death.

 

The assessment of the business scenario is vital; it takes patient and painstaking effort in terms of PoC and pilot projects to lay out a compelling case for a high performing alternative. Uh-oh, now that the business case is sold, one still needs to make sure the LM exercise is executed as per plan. At the end of an LM exercise, in hindsight the assessment phase is not just worthwhile but perhaps the most crucial step.

 

1

Top Technologies List,,,

   WinFX technologies, well rather .NET Fwk 3.0 technologies comprise WCF, WPF, WF and WCS. Each one promises to deliver some unique and new capabilities to end user applications. For creating an enterprise application, interplay of those technologies is must and very rarely can they act alone. However, I ignore that interplay fact and try to think about those technologies per se, to see how I will list them out, if somebody asks me to prepare a top-technologies list in WinFX context. Then my list will be,

1.WF (Windows Workflow Foundation)

2.WCF (Windows Communication Foundation)

3.WPF (Windows Presentation Foundation)

4.WCS (Windows CardSpace)

   I know, many might not agree with this list. But my reasoning (or prejudice!) behind it is, is given below.

   I completely accept the fact that workflow concept is not a trail-blazing technology and it has been here for quite a while, in various other forms. But MS has brought this concept into main stream of development community and let any windows application implement the workflow logic efficiently. If we observe, all processes (IT or non IT) revolve around the workflow logic. In fact, so far, we have been implementing this workflow based logic in more procedural or object oriented way. To be more precise, we bundle the individual pieces of workflow logic (sequence, branching, conditions and business rules) together and hide them within a procedural body. Optimized utilization of CPU cycles and memory resource may be the reasons for doing so. Now, bringing back workflow logic into limelight does the reverse processing of disintegrating the procedural logic into more discrete steps, which once got assimilated within procedural logic, of a workflow. The result is more clarity and transparency on internal working of an application.  Everybody would agree that these would lead the applications to better maintainability and to adopt future business changes quickly. Secondly, most of processes involve both system centric and human centric factors. The involvement of human factors into a process converts the static predictable nature of drama into highly dynamic and unpredictable thriller!!!. WF is amazingly flexible and extensible enough to handle such processes. That is why WF is in top of my list.

   The reason for the second slot of WCF is the amount of support it brings in converting a web service to be truly enterprise arsenal through its compliance to mind-boggling number of  ever growing WS-* specifications. No doubt that there is more extensibility and simplicity in WCF, but sort of deja-vu will still linger in the minds of people because of its ASP.NET web service like programming model. That familiarity really breeds contempt and made me put this not in the first slot Smile.

   WPF is great and it will make the UI applications rock and roll if deployed in system that is both high end and Vista compliant (both are one and the sameSmile). The user experience would be simply stunning if the application is media-content and graphics rich. MS seems to be on the top of the roof and clearly spells out WPF is not just for such applications alone. There will also be a few takers to its claims. I also agree with MS that even LOB applications require better UI and flexible controls. Personally, I already have experience in dealing with an application that required the great data visualization capability of WPF. And XAML is a good approach to declaratively define UI controls. But I think that business still will wait for some more time in taking decision on UI of its LOB applications, may be till its business layer technological complexities are sorted out. And I will not say developing WPF application is exactly similar to development of Win Form applications. But orcas development tools will make it more so. It is not a bad thing and in fact, people may find it great because they don’t need to unlearn something. But, as in the case of WCF, this familiarity again breeds my contempt and makes me place this lower to WCFSmile.

   It would be highly unfair if I try to say some technological reasons for placing WCS at the lowest rung of the list. It (being last in the list) has nothing to do with technology but has more to do with WCS’s late entry into WinFX fold of technologies. Very few documents are available as of now to raise the enthusiasm among the development community and to know its full scope. The importance and seriousness of the basic fact of utilizing WCS - a meta-identity based technology - to let end users take a control while distributing their identities and credentials to the not so great internet world wherein too many evils lurking in the dark side, could be completely understood by anybody who has his/her teeth into security concepts, but that is not enough to move it ahead in the list .

   Well, it might be too early to list them like this; and more wisdom extracted out of experience with these technologies, in future, may disrupt this order drastically. Who knows!!!!.

   And in future blogs, I will include more entries such as ASP.NET Web Services, .NET Remoting, Windows Form, ASP.NET web pages, Enterprise services, etc (you can either call them as non-WinFX technologies in .NET Fwk 3.0 or as .NET Fwk 2.0 technologies in .NET Fwk 3.0. See the problem that I had mentioned in my earlier blog - To Be Or Not To Be - about this naming confusionSmile ) and let us see where those technologies fit in the ordered list.

Legacy Modernization blog

Welcome to the blog on Legacy Modernization. There is a lot of interest among businesses to move out of their mainframes or at the least, modernize mainframe applications.

I am Karthik Venkatachalam, working on the legacy modernization solution at Microsoft Technology Center in Infosys. My interest is mainly modernization solutions that are focused on migration of workloads to the MS platform.

Introduction to VSTS Blog

Today morning, when I posted the VSTS introduction blog... Forgot to introduce my self. Ooops.. Let me introduce ...

I am Prashanth Govindaiah, a Technical Architect working in Microsoft Technology Center in Infosys. I have got around 8 years of experience in IT industry, most of it in Microsoft based technologies though have some working knowledge of Java Smile. For the past 4 years I have been working .NET technology. Currently, i am focusing on VSTS.

Keep a watch on this Blog of some cool stuff on VSTS and other Microsoft technologies and do let us know your views on these technologies.

Visual Studio Team System (VSTS)

"Before you start some work, always ask yourself three questions - Why am I doing it, What the results might be and Will I be successful. Only when you think deeply and find satisfactory answers to these questions, go ahead.”
Chanakya (Indian Politician, strategist and Writer, 350 BC-275 BC)

 

Well, this is precisely what I do before I take up any new work either official or pesonal. When I started with VSTS, I felt as if I had taken the less travelled road ("Road Not Taken" by RobertFrost) as we at Infosys had already got sophisticated tools and process in place for managing the SDLC of any type of Project.......

 

As I started studying the product deep, I saw a big value addition in terms of personalized tools provided for all the roles of SDLC and TFS tools/features.  VSTS is very strong in the Engineering tools  and ofcourse this being their first tool into the project management space, there is scope for improvement. I felt support for project management was not really very strong (through reporting is excellent) and  started looking at how well this can integrate with other project management tools using the customization and extensibility options of VSTS  

It has been quite some time now since I started looking at this . Well in my future postings I will put some of the good stuff I saw in VSTS, limitations and the work arounds we came up with  wrt this exercise ,... So do keep a watch on this blog site..

Have a nice day...SmileSmile

Thanks and Regards

PrashanthG

 

September 11, 2006

To Be Or Not To Be,,,

As any ardent fan of Shakespeare does, I too like the soliloquy of Hamlet – To be or not to be – very much. That universally acclaimed verbal frustration captures the essence of being in ambiguous state, unambiguouslySmile. Such ambiguity not only haunted the medieval prince but continues to haunt even modern-time technical people, albeit in different context. Undergoing mental agony, when you are trying to answer certain close-ended as well as technology options related technical queries, is no way less painful one than what Hamlet had to endureSmile.

A few such queries in .NET domain, relentlessly raised by people, for sample, given below:-

  • Does GC indeed solve all memory allocation related issues automatically?
  • Does it make sense to use .NET Remoting, when the entire world talks about Web Services?
  • Will we ever work, dealing only with managed code?
  • Are web services at their current state really interoperable with disparate platforms and technologies?
  • Can I go for ASP.NET Web Service or .NET Remoting?
  • Can I always use asynchronous pattern, as it is being considered to improve the performance, scalability and user experience of the application?
  • Tell me now, which one is better – smart client or web based application?
  • Can I go for WF or for BTS?

While it is true that these questions can not be reciprocated by starting with categorical yes or no, , these questions can be answered satisfactorily, if listener is willing to convert these queries into bit open ended and patient enough to lend his/her ear to some amount of technical detail. If you observe closely, you would realize that answers are inundated with various hypothetical scenarios and situations to nail down the points to be made.

We all know this is how it is going to be and hope only technological advancements in future will make us to be more unequivocal in our replies. As I have been working on .NET Framework 3.0 technologies, I wanted to revisit those questions to see whether answer pattern changes to some extent, now. Not so surprisingly, they are not. But surprisingly (and unfortunately) new technologies accentuate the ambiguities further.

In .NET Framework 3.0 (earlier named as WinFX technologies), we do come across set of technologies such as WPF (Windows Presentation Foundation), WCF (Windows Communication Foundation), WF (Windows Workflow Foundation) and WCS (Windows CardSpace).

Central theme for introducing these technologies is, to provide single, flexible and extensible programming model to achieve diverse things. For example, WCF is nothing but the unification of various technologies (ASP.NET Web Services, .NET Remoting, Enterprise Components, Messaging and Web Service Enhancements) under a singular programming model which closely resembles ASP.NET Web Service programming model. The same theme can be applied to WPF too, as WPF supports developing both desktop and browser based application using a single programming model (but WPF provides much more, and here I don’t intend to downplay all of its other significant changes that are to create stunning user experience applications by just highlighting this theme). Similarly, in WF, you can follow the same flexible programming model to handle and implement various types of workflow logic whether it involves only systems or combines the human factors with system centric tasks.

Now, .NET Framework 3.0, has not really discarded any of those which are part of .NET Framework 2.0, but adds the above mentioned exciting technologies into its repertoire. That, in fact, really accentuates certain ambiguities as I had mentioned earlier. Still it (or any other technology, for that matter) has to go a long way, to elicit categorical answers on close ended questions related to features such as whether GC is all that robust.  For those technology options related questions, now, context of question might slightly shift from “ASP.NET Web Service Vs .NET Remoting” to “WCF Vs ASP.NET Web Service Vs .NET Remoting” or from “Smart Client Vs Web based app” to “Smart Client Vs Web based app and if Smart Client, is it by using WPF or Win Form”. But answers loaded with “depends on a scenario” remain largely same but they become bit bloating now, because more scenarios need to be discussedSmile. It means, more patience and inclination to listen to technical details are to be expected from the people who raise the queries (if they do care for answersSmile).

BTB, sometimes, the name of the technology itself will be the provenance for ambiguity, as in the case of .NET Framework 3.0. Personally, I would like to totally agree with what Shakespeare had told, “what is in a name; that which we call a rose, by any other name would smell as sweet”, but unfortunately would not, in the case of naming of .NET Framework 3.0. It should have been left as WinFX technology. Main reason for that, I think is, you can really then distinguish the technologies of .NET Framework and WinFX (WinFX as next generation technologies but being supported in a few existing OSs such as WinXP and Win2K3). And another fact that .NET Framework 3.0 is not supported in Windows 2000 is a bitter capsule to swallow. But truth is .NET Framework 3.0 still can be supported in Windows 2000 if WinFX technologies have been left as they were, and as extra features to .NET Framework 3.0 (which as an improved version).

Anyway, not only we but software technologies too are such stuff that dreams are made on. Not a big deal even if they are bit quirky in their names and concepts.

.NET Fwk and Vista technologies,,,

Welcome to Infosys blogs on MS technologies.

I am Ganesan Krishnamurthy, working in Microsoft Technology Center in Infosys. I have got around 12 years of experience in IT industry and have been working in .NET technology since its beta stage. Currently, i am focussing on .NET Framework 3.0 technologies. I will blog about quite a lot of interesting things that do happen in .NET Framework, Vista and Longhorn world.

Stay tuned to these blogs and let me know about your views on these technologies.

 

 

BizTalk - Edit and re-publish Policies and Vocabularies

When working with BizTalk's Business Rules Engine (BRE), one of the issues all face is that once published/deployed, vocabularies and policies become immutable. For a project that is in development this can cause lot of pain since there will be unnecessarily too many versions as the vocabularies and policies evolve. While taking this to production we can definitely pick the latest and final versions and deploy them, but to help make development more easy we can do a bit of under the hood work with the BRE database.

Even though I haven't faced any issues in the rules execution by following the approach discussed below, I will strongly discourage using this on Production systems.

Direct editing of BizTalk databases isn't a good practice and if alternatives are available, they should be used. Like in this case, one can use Policy Verificator from Acumen Business. This is a great free tool to have, but you do need a login id on the site to be able to download. A version of Policy Verificator that will work with BizTalk 2006, however, is ccurrently not available.

OK, back to the discussion. To revert a vocabulary from its published status to saved status, so that you can edit it, go to re_vocabulary table in BizTalkRuleEngineDb (this is the default DB name). For the vocabulary in question, alter the value in nStatus column to 0 (saved) from 1 (published). You can now go back to the Business Rules Composer and work with vocabulary like any other and publish it again from the composer when done. You could also republish this by once again setting the nStatus column value to 1, however publishing from Composer is easier.

Unlike vocabulary, policies have three states - 0 (saved), 1 (published) and 1 (deployed). Notice that though the states are three, the value of "1" is used to represent both published and deployed policies. So how do you distinguish the two states? If there is an entry in the re_deployment_config table for the policy (re_deployment_config.nRuleSetID = re_ruleset.nRuleSetID) in question, it is deployed else published. In either state, there will be an entry for the policy in the re_tracking_id table. Incidently, the deployment status is additionally tracked via re_deployment_history, which captures when a policy was deployed and also undeployed.

Armed with this knowledge, it is easy to see that we can once again alter the nStatus column value to 0 in the re_ruleset table to make an already published/deployed policy available for editing via the Composer. However just doing this will result in a primary key violation on the re_tracking_id table when you try to re-publish such a policy via the Composer. You can hence take two approaches

  1. First undeploy the policy using the Composer. Then change nStatus column value to 0 in the re_ruleset table. Finally delete the matching row (on nRuleSetID) from the re_tracking_id table.
  2. Change the nStatus column value to 0 in the re_ruleset table. Delete the matching row (on nRuleSetID) from re_tracking_id and re_deployment_config tables.

Having done either of the two steps above, launch the Composer and edit the policy as required and then publish and deploy again from the Composer itself.

There will be some delay before you will start seeing your new policies/vocabularies in action as per the polling interval (default of 60 secs) for the Rules Engine Update Service.

BizTalk Blog

As part of our blogs on Microsoft products and technologies, as mentioned by Balaji, I will be focusing on BizTalk Server 2006.  

My name is Atul Gupta and I am Senior Technical Architect working with the Microsoft group in Infosys. I have been working on Microsoft based technologies for more than 11 years now. Have had exposure to C, C++, MFC, COM, DCOM, .Net 1.1, ASP.NET 1.1, .Net 2.0, ASP.NET 2.0, Winforms, SmartClient etc. On the server side, I have worked with BizTalk, Commerce Server and SQL server. I am also Microsoft MVP.

Looking forward to having interesting discussions on this blog!

Welcome!!!

Welcome to our blog on Microsoft products, technologies and solutions on the Microsoft platform. My name is Balaji Sampath and I am responsible for marketing of our alliance with Microsoft and our solutions on the Microsoft platform. On this blog, you will find Infosys' practitioners share and discuss their views on their specific areas of specialization on Microsoft – from technologies and products such as .NET, BizTalk, VSTS to solutions in the areas of Legacy Modernization, Connected Business & Infrastructure Optimization. You will also see discussions on our joint IT-led business transformation initiative with Microsoft, called Catalytic IT.

We encourage you to participate and share your perspectives in this forum.

Welcome, once again!!!

Subscribe to this blog's feed

Infosys on Twitter