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.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
Expand all | Collapse all

exitFlow

  • 1.  exitFlow

    Posted 06/24/09 04:47 PM

    Hi ,

    Is a way that we ‘exitFlow with signalFailure’ from Child service and still have the pipeline data available in Parent service ?


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


  • 2.  RE: exitFlow

    Posted 06/24/09 05:15 PM

    In the parent service, in the catch block, invoke pub.flow:getLastError service and in the getLastError/pipeline document you will have the pipeline data until the point of exception. Using a simple map step you can retrieve the values back.

    Cheers
    Guna
    http://www.nibodo.com


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


  • 3.  RE: exitFlow

    Posted 06/24/09 05:26 PM

    Gunasekhar,
    Not getting like that … Below is the scenario …

    I have 3 services as follows …

    ParentSvc in try/catch block
    calling ChildSvc1 inside this …
    calling ChildSvc2 inside this

    ChildSvc1 is again having try/catch block (I need this to handle some exceptions in catch block)
    In catch block of ChildSvc1 , last step is ‘exitFlow signal failure’ . I need this because it should not continue processing ChildSvc2 in ParentSvc if there is an error in ChildSvc1 .

    Now , the control comes to catch block of ParentSvc when it failes in ChildSvc1 .

    By this time iam losing all pipeline data … which I need some of it here …


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


  • 4.  RE: exitFlow

    Posted 06/24/09 07:17 PM

    Items to consider:

    • When a service uses EXIT and signal FAILURE, a call to getLastError will not return anything (exit doesn’t throw an exception). Thus, lastError/pipeline won’t exist.

    • To throw a ServiceException, you can write a Java service (or use an existing service, such as one from PSUtilities) that accepts an message input and throws the ServiceException. This will put the state of the thread such that getLastError will return the error and the state of the pipeline at the time of the error.

    • Keep in mind that any variable declared/defined in the try block will not be directly available in the catch block (this is the same scoping behavior as virtually every programming language–vars defined in the try block are not visible in the catch block). If you want the var to be visible, define it outside of the try/catch sequence blocks. In the catch block, the var will then be visible and will hold the latest value that was set anywhere before the catch, even if mapped/set in the try block.

    Hope this helps.


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


  • 5.  RE: exitFlow

    Posted 06/25/09 02:43 PM

    Hi Reamon,
    Now I remember writing java service to do the job.
    Good reminder. Thanks.

    Cheers
    Guna
    http://www.nibodo.com


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


  • 6.  RE: exitFlow

    Posted 06/26/09 05:56 PM

    Gunasekhar and reamon,

    Thanks for all your inputs .. I have managed to acheive this with some workaround using savePipeline and restorePipeline ...
    

    Thanks,
    Sasi …


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


  • 7.  RE: exitFlow

    Posted 06/29/09 05:36 PM

    Hey -

    Sorry for chiming in a little late. Here are my comments though:

    1. “Exit and signal failure” does indeed throw an exception. It throws a com.wm.lang.flow.FlowException and you can use getLastError as you would with other exceptions.
    2. savePipeline and restorePipeline are normally used for debugging purposes. Nothing prevents you from using it for the purposes you’re describing, but it would normally not be considered good practice. Refer to Rob’s 3rd point and that should help you identify which variables you need to define outside the catch-block and which variables you should pull from lastError/pipeline.
    • Percio

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


  • 8.  RE: exitFlow

    Posted 06/29/09 06:38 PM

    You’re right, it does throw an exception. FlowException instead of ServiceException. You can call getLastError but there won’t be anything in it–nothing is returned.

    I verified this behavior with 7.1.2 (FLOW has behaved this way for some time).


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


  • 9.  RE: exitFlow

    Posted 06/29/09 06:41 PM

    Be careful about the modularity aspects here. As Percio points out, save/restore really isn’t intended for this purpose.

    Perhaps you can post your services (or a representative example) and we can help structure things such that the data you need is visible at the right spots.


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


  • 10.  RE: exitFlow

    Posted 06/29/09 06:52 PM

    Rob,

    Maybe we’re talking about different things. I’ve always used “EXIT and signal failure” and getLastError returns exactly what I would expect. I just tested it in 7.1.2 and it worked.

    There’s one scenario in which “EXIT and signal failure” does not work as most people would expect: if you setup a try-catch block and inside the try block in that same service you execute an “EXIT and signal failure” step, control will be transferred to the catch block, but like you said, getLastError won’t return anything.

    However, if you setup a try-catch block, inside the try block you call another service and that service (or one of its children) executes “EXIT and signal failure”, control will be transferred back to the catch block of the parent and getLastError will return what is expected.

    I apologize if I have misunderstood your post.

    • Percio

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


  • 11.  RE: exitFlow

    Posted 06/29/09 07:39 PM

    Great clarification. It was indeed the first scenario I was referring to. Thanks for sharing the second scenario–I wasn’t aware of the difference in behavior for getLastError in this case. Thanks for sharing!


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


  • 12.  RE: exitFlow

    Posted 06/29/09 08:47 PM

    You’re welcome. The way the EXIT step works (or doesn’t work, for that matter) is definitely quirky. I remember being a little confused and disappointed when I first came across it.

    • Percio

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


  • 13.  RE: exitFlow

    Posted 07/07/09 11:29 AM

    lets say if we are having a 4 level hierarchy flow services, and if in the Child service “Flow4” i’m using Exit step, is it possible to exit from ParentFlow1 directly without the control going to the catch blocks of Flow 2 and 3.

    ParentFlow1
    [INDENT]Flow2[/INDENT]
    [INDENT][INDENT]Flow3[/INDENT][/INDENT]
    [INDENT][INDENT][INDENT]Flow4[/INDENT][/INDENT][/INDENT]
    [INDENT][INDENT][INDENT]Exit from ??? Signal Failure[/INDENT][/INDENT][/INDENT]


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


  • 14.  RE: exitFlow

    Posted 07/07/09 10:15 PM

    No. If you throw an exception, the exception will be propagated down through the call stack.

    Can you provide some more details around what you’re trying to accomplish? We should be able to help you arrive at a sound solution.

    • Percio

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


  • 15.  RE: exitFlow

    Posted 07/08/09 03:00 AM

    You might have too many try/catch blocks. Normally, only top-level services should have try/catch unless there are specific errors you need to handle in child services.


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


  • 16.  RE: exitFlow

    Posted 07/08/09 12:46 PM

    Thanks Percio/Rob for the reply,

    I have the error notification service in the Parent Flow. and I thought of putting the pipeline data, at the time of error , in to the error notification. By the time the control comes back to the Parent flow, the call stack would have duplicated items, and that would increase the message size.
    Hence was looking to have smaller call stack.


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


  • 17.  RE: exitFlow

    Posted 08/12/09 10:12 AM

    This is it!!! This is kinda annoying… :-/


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