Wednesday, September 24, 2008

BizTalk 2006 MMC snap-in limitation

No doubt BizTalk 2006 MMC snap-in is a great move forward since the days of BizTalk 2004 Explorer Add-in. although, the GUI itself suffers sometimes from a problem or another. I think the mostly common problems are missing features or incomplete implementation. one example is when you try to start application. you can right click on the BizTalk application name and choose start. in this case, BizTalk administration console consider the activity to be under one 'transaction' so if one orchestration in one application fails in the start process - all other orchestrations, send-ports etc. in the whole application will automatically rollback to the previous state.

The reason is that under the surface the GUI is using Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer class (please note that it's actually also make use of Microsoft.BizTalk.ApplicationDeployment.Group class - but I'll ignore that for the moment).  when you creates instance of this class and make some changes to send-port etc. the change will not reflect to BizTalkMgmtDb until a call to the SaveChanges() method.

If I could select all the applications in the BizTalk Group and choose them to start (a great feature that for some unknown reason is forbidden and you can start only exactly one application at a time )  the pseudo code in the MMC is something like this:

Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer e = new Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer();
            e.ConnectionString = @"Data Source=" + dbServerName + ";Initial Catalog=BizTalkMgmtDb;Integrated Security=True";
 
            try
            {
                foreach (Microsoft.BizTalk.ExplorerOM.Application app in e.Applications)
                {
                    app.Start(Microsoft.BizTalk.ExplorerOM.ApplicationStartOption.StartAll);
                }
 
                e.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

As you can see, all successfully started applications state has not been saved because that one application failed.


I think it's need to be like this:


            foreach (Microsoft.BizTalk.ExplorerOM.Application app in e.Applications)
            {
                try
                {
                    app.Start(Microsoft.BizTalk.ExplorerOM.ApplicationStartOption.StartAll);
                }
                catch (Exception ex)
                {
                    bool whatToDo = AskTheUserWhatToDo();
 
                    if (whatToDo)
                        throw ex;
                }
            }
 
            e.SaveChanges();

As an insight, the semi-unfriendly BizTalk 2006 Administration console GUI is not a direct effect of BizTalk deployment API's architecture - it's more like a half implementation in the MMC snap-in.

 
Copyright © 2007 | Diseñado por Blog and Web