IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Try catch and FInally

    Posted Tue October 15, 2019 03:25 AM

    Hi All,

    I have below scenario for try/catch, could you please me on understanding?

    1.) Seq–Main (exit on - Success)
    Seq–Try (exit on - Success)
    Seq–Catch(exit on - Done)

    2.) Seq–Main (exit on - Success)
    Seq–Try (exit on - Success)
    Seq–Catch(exit on - Done)
    Seq–Finally(exit on - Done)

    3.) 2.) Seq–Main (exit on - Success)
    Seq–Try (exit on - Success)
    Seq–Catch(exit on - Done)
    Seq–Finally(exit on - Success)

    in above scenario catch and finally will execute or not.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: Try catch and FInally

    Posted Tue October 15, 2019 02:17 PM

    Hi Hariom,

    the Try-Sequence should be set to “Exit on Failure”.

    When the Try-Sequence completes without error it will automatically report “Success” to the outer sequence.
    When the Try-Sequence encounters an error it will report “Failure” to the outer sequence causing the Catch-Sequence to be executed.

    I think that the Finally-Sequence will never be executed as the Catch-Sequence reporting “Done” at the end is interpreted as “Success” in the outer squence.

    Regards,
    Holger


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 3.  RE: Try catch and FInally

    Posted Wed October 16, 2019 04:16 AM

    Hi Holger,

    Thank you for your response.

    Could you please explain based on sequence?

    Regards
    Hariom


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Try catch and FInally

    Posted Wed October 16, 2019 09:29 AM

    Hi Hariom,

    outline for correct Try-Catch-Sequence is the following:

    SEQ (outer, Exit on Success)

    • SEQ (inner1 for Try, Exit on Failure)
    • SEQ (inner2 for Catch, Exit on Done)

    When inner1 completes without error, it will report Success to outer sequence and inner2 is skipped.
    When inner1 fails with an error, it will report Failure to outer sequence and inner2 is executed.
    As inner2 is defined as “Exit on Done”, it will complete and report Success to outer sequence.
    After that outer sequence is completed so there is no chance for a Finally sequence under outer sequence to be executed.
    Anything what should go in the Finally sequence should be placed after the outer sequence.

    Regards,
    Holger


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB