ESB Toolkit 2.0 : Exception Management Hello World

Posted at: 6/11/2009 at 10:18 AM by saravana

ESB Toolkit 2.0 comes with set of components that help you build loosely coupled ESB/SOA application on top of BizTalk Server 2009. You can take advantage of the ESB Toolkit by using only certain components of the package relevant to your application. One of the core components of the toolkit is the Exception Management Framework, which comes with the required helper components, web services, BizTalk ports, a sophisticated management portal etc that will help you build a standard and scalable exception management platform for your application without much custom coding.

It's always a problem for lot of us to get a starting point. In this post, I'll put a complete walk through of building a Hello World application to show you the basic idea of the Exception Management Framework in the ESB Toolkit. Before starting this exercise please make sure the ESB Toolkit is installed and configured correctly, and you got a working Exception Management Portal. Refer to my previous posts (here and here) showing how to set it up.

Solution:

Our sample application receives an Employee Request (id, firstName, lastName, Date of Birth) into an Orchestration. Age is calculated and an Employee Response (id, age) is send to an end point. If DOB field is invalid, it will result in an exception. The Orchestration got an exception handling logic (the way you do it normally using scope and exception handler). The only addition to "Catch Exception" logic is we construct the ESB fault message and submit it to MessageBox via Direct binding (no additional send ports required). The below figure shows the whole orchestration.

image

Step 1:

In order to use the ESB exception handling framework you need to reference couple of dlls. Add Reference to the following dlls inside your Orchestration project.

C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bin\Microsoft.Practices.ESB.ExceptionHandling.dll

C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bin\Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.dll

Step 2:

Declare a new Orchestration message (ex: MSG_FAULT) and set the MessageType to Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.FaultMessage, which you can find under the "Select from Referenced Assembly.." option.

Step 3:

Inside your Exception handling block construct the fault message (the one created in step 2) with relevant information required. The code will look like

   1: // Create Fault Exception Message
   2: MSG_FAULT = Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage(); 
   3:  
   4: //Assign some properties
   5: MSG_FAULT.FailureCategory = "Some User Category";
   6: MSG_FAULT.FaultDescription = ex.Message;
   7: MSG_FAULT.FaultCode = "3002002"
   8: MSG_FAULT.FaultSeverity =
   9: Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Severe; 
  10:  
  11: //Add request message (any other message if present)
  12: Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(MSG_FAULT,MSG_EMP_REQUEST);

Step 4:

Create a "Direct" bound port and link this logical port with the send shape that's configured to send MSG_FAULT as shown in the above figure. Since its a Direct bound port no additional port configuration is required from your orchestration apart from your regular business related ones.

That's all really, how simple is it!!

Whenever there is an exception in our application an ESB Fault message will be generated and published to the MessageBox. Lot of properties will be promoted when this fault message is published, so you can construct your own error handling Orchestration to deal with the situation or have a send port configured to send email, send to MQ etc, etc the choice is yours. In addition to your own logic, the ESB Core application got a standard "All.Exception" send port (SQL Adapter) configured to capture any Fault message arising in the system and log it to the Exception management database. As part of the fault message lot of properties are added things like machine name, application name, service name, service instance id, etc etc which all gets inserted into the exception management database automatically and show up nicely in the portal as shown in the below figure taken from the management portal (default address http://localhost/ESB.Portal ).

image

image

image

Hope this gives a quick intro to get you started.

Nandri,

Saravana

Tags:  Categories: BizTalk 2009
Actions: Email this article Email | Kick it! | DZone it! | Save to del.icio.us | Technorati Links
Post Information: Permanent LinkPermalink | CommentsComments(8) | Comments RSS

Comments

Monday, July 26, 2010 3:23 PM
loans
Rise above the storm and you will find the sunshine.
Thursday, August 05, 2010 10:58 AM
Payday Loans
Wise words loans!
Sunday, August 15, 2010 11:04 AM
Jeremiah
I just hope to have understood this the way it was meant
Sunday, August 15, 2010 11:08 AM
Apartments for rent in dubai
Valuable information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!! Thumbs up
Sunday, August 15, 2010 11:09 AM
Dubai rent
I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commentators here!
Sunday, August 15, 2010 11:10 AM
Dubai rent
I really like the work that has gone into making the post. I will be sure to tell my blog buddies about your content keep up the good work. Thanks
Sunday, August 15, 2010 11:17 AM
Social Networking
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.
Saturday, August 28, 2010 9:24 AM
fgtyhyuj People's Republic of China
fgtyhyuj
相关链接:
<a href="http://blog.gutx.com/blog/fhggftty6/">安溪铁观音</a>
<a href="http://gfhftgh.5d6d.com/">铁观音</a>
<a href="http://fhfddg56.5d6d.com/">膜结构</a>
<a href="http://ftrry776.5d6d.com/">膜结构公司</a>
<a href="http://tdthhkl88.5d6d.com/">膜结构工程</a>
<a href="http://vbbnnb238.5d6d.com/">广西玉林家具</a>
<a href="http://dftgrtyh88.uueasy.com/">广西玉林办公家具厂</a>
<a href="http://dfggnhcf6.5d6d.com/">家具厂</a>
<a href="http://ghtyr8911.5d6d.com/">办公家具厂</a>
<a href="http://fdgbvf.uueasy.com/">家具厂</a>
<a href="http://6utyuyu.5d6d.com/">螺杆空压机</a>
<a href="http://dfgty77688.uueasy.com/">广西玉林酒店家具厂</a>
<a href="http://tyht576.5d6d.com/">空气压缩机</a>
<a href="http://vhbfgh.5d6d.com/">石材雕刻机</a>
<a href="http://ygghhy88.5d6d.com/">石材机械</a>
<a href="http://dghjhgt6.5d6d.com/">石材切割机</a>
<a href="http://hhhfggyy88.5d6d.com/">高压水泵</a>
<a href="http://ghjkyhhj.5d6d.com/">进口轴承</a>
<a href="http://fdggt778.5d6d.com/">滑动轴承</a>
<a href="http://ftwery67.5d6d.com/">塑料破碎机</a>
<a href="http://uyide88588.5d6d.com/">破碎机</a>
<a href="http://xdertyy688.5d6d.com/">电动车电池</a>
<a href="http://fgytry.5d6d.com/">塑料制品</a>
<a href="http://gdthh88.5d6d.com/">塑料制品厂</a>
<a href="http://dvffgh88.5d6d.com/">塑料原料</a>
<a href="http://gfhhgth678.5d6d.com/">轮胎翻新</a>
<a href="http://fdbgfnb.5d6d.com/">飞机模型</a>
<a href="http://58858.5d6d.com/">服装批发</a>
<a href="http://blog.gutx.com/blog/fghfghv88/">香港六閤綵公司</a>
<a href="http://87766.5d6d.com/forum-9-1.html">玉林婚纱摄影</a>
<a href="http://nmjkiu8.5d6d.com/">南宁论坛</a>
<a href="http://87766.5d6d.com/">玉林论坛</a>

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading