ESB Exception Handling in Orchestration

In Orchestration when there is requirement is that all the exception should be logged into ESB Management Portal or ESB Exception Database, then we need to add some code in orchestration catch block to send exception to ESB Exception Db and Management Portal.

We need to follow the below process to send exception details to ESB

  1. Firstly we need to add bellow dlls in reference of the project. you can get these dlls in GAC

Dlls.jpg

2. Add exception massage in orchestration with  Message Type           Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.FaultMessage     

   EsbExceptionMessage.jpg

3.  In catch block create a message Assignment shape and write below code

ExceptionMsg = Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage();

ExceptionMsg.FailureCategory = “SystemException”;

ExceptionMsg.FaultSeverity =  Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Error;

ExceptionMsg.FaultCode =”1″;

ExceptionMsg.FaultDescription = systemException.Message.ToString(); 

Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(ExceptionMsg, ReceiveMsg);

ExpressionShapeDetails.jpg

You can change the message description according Business requirement. In last line AddMessage function contains Exception message first and then provide that message which you want to get from ESB Portal.

4. Create a Correlation type and corresponding correlation set with below property assign in correlation type:

  • Practices.ESB.ExceptionHandling.Schemas.Property.Application
  • Practices.ESB.ExceptionHandling.Schemas.Property.FaultCode

CorrelationProperties.jpg

5. Define Correlation Sets

Correlation.jpg

6. Create a send port and assign exception message and initiate correlation set as define above. SendPortConfiguration.jpg

    7. Port Configuration should always be direct binding for this send port. As below                  screenshot.

PortConfuguration.jpg

 

Now build and deploy the application.

Advertisements

3 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s