Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Using Microsoft .NET in WebSphere Message Broker V8: Part 4: Using the .NETCompute node for exception handling

Ben Thompson (bthomps@uk.ibm.com), Consulting IT Specialist, IBM
Author photo
Ben Thompson is a Consulting IT Specialist working on the WebSphere Message Broker development team at the IBM Hursley Software Lab in the UK. He is currently working on the design and implementation of .NET support in Message Broker. In the past, he has worked for IBM Software Services for WebSphere designing and implementing WebSphere solutions for IBM customers worldwide. You can contact Ben at bthomps@uk.ibm.com.
(An IBM developerWorks Contributing Author)
Matthew Golby-Kirk (mgk@uk.ibm.com), Software Developer, IBM
Matthew Golby-Kirk photo
Matthew Golby-Kirk is a software developer working on the WebSphere Message Broker development team at the IBM Hursley Software Lab in the UK. He works on the design and implementation of the HTTP and Web services support, along with the ESQL language run time in WebSphere Message Broker. You can contact Matthew at mgk@uk.ibm.com.

Summary:  This series of four tutorials demonstrates the new support for Microsoft .NET in WebSphere Message Broker V8. Part 4 shows you how to use the .NETCompute node for exception handling, using a scenario that builds in complexity as additional exception conditions are deliberately produced and then handled. Readers should be familiar with either Microsoft .NET or WebSphere Message Broker, but need not be familiar with both.

View more content in this series

Date:  22 Feb 2012
Level:  Intermediate

Comments:  

Catching a message flow exception

  1. Return to MyFlow, which should still be open in the WebSphere Message Broker Toolkit. You will modify the message flow in order to catch the rollback, and then record the exception using a Trace node. Create a Trace node by dragging and dropping it onto the canvas from the Construction drawer of the palette and then wire it to the Catch terminal of the MQ Input node:

    MyFlow with Trace node Catch path

    The exception list tree is a logical message tree in which the message flow writes information about exceptions that occur when a message is processed. If an exception condition occurs, message processing is suspended and an exception is thrown. Control is passed back to a higher level -- that is, a Catch terminal or TryCatch node in the flow. Then an exception list is built to describe the failure condition, and the whole message, together with the local environment tree and the newly-populated exception list, is propagated through an exception-handling message flow path. In the case of this example message flow, the exception-handling message flow path is the one wired to the Catch terminal of the MQ Input node.
  2. Set the Trace node properties as shown below, so that the Root Message and ExceptionList structures are written to the file C:\student\DOTNET\lab_exceptions\trace.txt when the flow back is sent down the Catch branch of the message flow:

    Trace node properties
    Set the Destination property to File and the File path property to C:\student\DOTNET\lab_exceptions\trace.txt. The listing below provides the Pattern property to let you easily cut and paste the text:

    Listing 1. Text for the pattern property of the Trace node
    
    ===== ${CURRENT_TIMESTAMP} =====
    The Root of the message is:
    ${Root}
    The ExceptionList structure is:
    ${ExceptionList}
    

    Save the message flow: Type Ctrl-S or select File => Save.
  3. Retest the message flow: Return to the test client file that you created in the first section of the tutorial, named App_DotNet_Exceptions.mbtest. Right-click the Invoke Message Flow level of the hierarchy on the left and select Re-run:

    Test the Catch branch
  4. After the test has completed, the test client should look like the image below:

    Result of test 2
  5. Return to the Event Viewer, and you should see some Information messages about the successful redeploy that you just executed, except this time you should not see any error messages, because the flow has caught the exception and handled it by wiring it to the Trace node:

    Windows Event Log 2
  6. Use NotePad to open the trace file that the Trace node should have generated for you at C:\student\DOTNET\lab_exceptions\trace.txt. Check the ExceptionList structure, which contains the UserException generated by the Throw node generated. It should look like this:

    Listing 2. Trace of the ExceptionList recorded down the Catch branch:
    
    The ExceptionList structure is:
    ( ['MQROOT' : 0xd6bd4c0]
      (0x01000000:Name):UserException = (
        (0x03000000:NameValue):File     = 
           'F:\build\S000_P\src\DataFlowEngine\BasicNodes\ImbThrowNode.cpp' (CHARACTER)
        (0x03000000:NameValue):Line     = 265 (INTEGER)
        (0x03000000:NameValue):Function = 'ImbThrowNode::evaluate' (CHARACTER)
        (0x03000000:NameValue):Type     = 'ComIbmThrowNode' (CHARACTER)
        (0x03000000:NameValue):Name     = 'MyFlow#FCMComposite_1_2' (CHARACTER)
        (0x03000000:NameValue):Label    = 'MyFlow.Throw' (CHARACTER)
        (0x03000000:NameValue):Catalog  = 'BIPmsgs' (CHARACTER)
        (0x03000000:NameValue):Severity = 1 (INTEGER)
        (0x03000000:NameValue):Number   = 3001 (INTEGER)
        (0x03000000:NameValue):Text     = 'User exception thrown 
           by throw node' (CHARACTER)
        (0x01000000:Name     ):Insert   = (
          (0x03000000:NameValue):Type = 5 (INTEGER)
          (0x03000000:NameValue):Text = 'This is a deliberate exception!' (CHARACTER)
        )
      )
    )
    

This section of the tutorial introduced the Message Broker ExceptionList and shown that if a simple exception is caught and handled by a message flow, then no errors are written to the Windows Event Log. In the next section, you will use a .NETCompute node to catch and format an exception that has been routed to it from the Catch terminal of the MQInput node.

3 of 10 | Previous | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=795296
TutorialTitle=Using Microsoft .NET in WebSphere Message Broker V8: Part 4: Using the .NETCompute node for exception handling
publish-date=02222012
author1-email=bthomps@uk.ibm.com
author1-email-cc=
author2-email=mgk@uk.ibm.com
author2-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).