Clone the pipeline

Hi,

I would like to know if there is a way to clone a webMethods Pipeline in a WM Flow Service.

I understand that IDataUtil.clone(pipeline) which can be used in a java service. But, is there anyway we could achieve the same in a Flow Service

I don’t think there is a FLOW service for this but you could write a Java service to do this, which would be callable from other FLOW services.

This seems like a strange need. Can you share a bit more of what you’re trying to accomplish and why cloning the pipeline seems like the right solution? Do you need a “deep” clone (expensive) or would a “shallow” clone (dangerous) suffice? Would savePipelineToFile/restorePipelineFromFile do what you want?

I am looking at a generic multi threaded wm service that could invoke other services concurrently…

Say… I need to invoke Services s1, s2 and again s1 simultaneously ( using java threads)…

Service s1 requires a parameter p1 which I can post to the pipeline… But I need a way to differentiate between the data for the First Service s1 and the Third Service s1.

I need to differentiate the “pipeline”

See the example in WmSamples samples.threads

You’ll need to drop down to a Java Service to accomplish exactly what you’re looking to do. Specifically your Java service will have to make use of the Service.doThreadInvoke().

You’ll need to make sure that you create a ‘new’ pipeline that contains the data that each service is expecting. Note as long as you are dealing with Strings you don’t have to clone the objects, but any other mutable type will need to be cloned if the services make any modifications to the input parameters.

You also need to retrieve the results of the services if there is any output from them that you need to return from the new service.

If you do a savePipelineToFile in the source service and do a restorePipelineFromFile with the same pipeline filename but another service - you’ve effectively cloned the pipeline, right?

Of course, you probably don’t want to write and read from disk to clone the pipeline - but this could be an angle to approach this problem from.