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.


#TechXchangePresenter
 View Only
Expand all | Collapse all

How to skip a service execution in Flow services.

  • 1.  How to skip a service execution in Flow services.

    Posted Thu December 26, 2013 08:21 AM

    Hi All,

    I have a flow service called “com.xx.addition”. In 5th line of that service i am calling another service called as “com.xx.getValue”.

    If I run “addition” service it will run the “getValue” service. I dont want to execute the getValue service. How to skip it at runtime. ?

    I can delete/diable the getValue from the addition service but i am using that getValue in lot more services. Please help, how to skip a service execution in flow services.

    Thanks,
    Guru


    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: How to skip a service execution in Flow services.

    Posted Thu December 26, 2013 08:57 AM

    If you don’t want to execute the “getValue” forever, like what you said, you can just delete or disable it.

    If you want to skip it depends on some run-time variable, you can use the branch step.


    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: How to skip a service execution in Flow services.

    Posted Thu December 26, 2013 01:09 PM

    Hi,

    Thanks for the quick reply.
    But in my actual code I have used storePipeline,restorePipeline services. So I want to keep this services in Dev environment and actual environment i want to skip these services execution.

    Can you have any idea how can i skip (or any properties) these services execution in actual environment.

    Thanks,
    Guru


    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: How to skip a service execution in Flow services.

    Posted Thu December 26, 2013 02:55 PM

    Yes delete/disable just make sense for it not execute it.

    HTH,
    RMG


    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: How to skip a service execution in Flow services.

    Posted Thu December 26, 2013 09:27 PM

    How about generate a service “isDev”, return true in development environment and false in production, then branch the variable in your flow, only invoke some services when it’s true.

    Just for savePipeline and restorePipeline functionalities, you can use the pipeline debug properties(version 8 or higher) instead of invoke these two services.


    #Integration-Server-and-ESB
    #webMethods


  • 6.  RE: How to skip a service execution in Flow services.

    Posted Fri December 27, 2013 12:44 AM

    Yes, your corret if the code is in begging level. But in my case the code written long back and now I have to disable these (save,restore invokes) services in all of the packages(30) with out touching the code. So I am looking for a property/option where I can specify the service names global, which skip the execution at runtime.


    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: How to skip a service execution in Flow services.

    Posted Fri December 27, 2013 10:17 AM

    I believe you cannot disable just the steps in the back ground ie the dead code and yes you can disable the package from the manifest file…Check the underlying service’s flow.xml or node.ndf if that is possible option in your case.

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webMethods


  • 8.  RE: How to skip a service execution in Flow services.

    Posted Fri December 27, 2013 11:25 AM

    I don’t think there is such a property. But if you are worry about the workload to change all 30 packages, you can use the java service below to automatically disable all the services you don’t want to execute in a flow service.

    Two intpus:
    String - serviceName - the NSName string of a flow service you want to disable something
    String List - blacklist - the NSName string list of services you want to disabled

    No outpus:

    In code tab:
    IDataCursor pipelineCursor = pipeline.getCursor();
    String serviceName = IDataUtil.getString( pipelineCursor, “serviceName” );
    String blacklist = IDataUtil.getStringArray( pipelineCursor, “blacklist” );
    pipelineCursor.destroy();

    NSNode nsNode = Namespace.current().getNode(serviceName);
    if (nsNode instanceof FlowSvcImpl){
    FlowSvcImpl flowService = (FlowSvcImpl)nsNode;
    FlowRoot flowRoot = flowService.getFlowRoot();
    disable(flowRoot, Arrays.asList(blacklist));
    }

    In shared tab:
    Imports:
    com.wm.app.b2b.server.ns.Namespace
    com.wm.lang.ns.NSNode
    com.wm.lang.flow.FlowRoot
    com.wm.lang.flow.FlowElement
    com.wm.lang.flow.FlowInvoke
    com.wm.app.b2b.server.FlowSvcImpl
    java.util.List
    java.util.Arrays

    public static void disable(FlowElement element, final List blacklist){
    int nodeCount = element.getNodeCount();
    for (int i = 0; i < nodeCount; i++){
    FlowElement childElement = element.getNodeAt(i);
    String childElementType = childElement.getFlowType();
    if (childElementType.equals(FlowElement.TYPE_INVOKE)){
    FlowInvoke invokeElement = (FlowInvoke)childElement;
    String service = invokeElement.getService().toString();
    if (blacklist.contains(service)){
    childElement.setEnabled(false);
    }
    }else{
    disable(childElement, blacklist);
    }
    }
    }

    This service can’t disable a transformer service invoked in a map step, if you also want to disable them, you need to add additional code for FlowElement.TYPE_MAPINVOKE, I am lazy :slight_smile:


    #webMethods
    #Integration-Server-and-ESB


  • 9.  RE: How to skip a service execution in Flow services.

    Posted Fri December 27, 2013 04:51 PM

    yes you have a work around sample above:)


    #Integration-Server-and-ESB
    #webMethods