conductor icon indicating copy to clipboard operation
conductor copied to clipboard

How to extract reponse of workflow in client

Open veveeran opened this issue 8 years ago • 5 comments

I am invoking workflow through ConductorServer class, is it possible to get output of workflow in the cConductorServer class.?

I also have one more query

  1. is it possible to invoke task which is part of workflow separately through ConductorServer?

Actually what I need to do is , I have many http tasks in the workflow, for some of the http task I need to get response of it, and alter the response and pass it to as input to another http task. is it possible to achieve this through ConductorServer?

veveeran avatar Jun 21 '18 05:06 veveeran

@veveeran Yes we can get the output from an workflow API given by conductor First of all we need to have outputParameters properly defined in our workflow. After workflow created successfully, will get unique workflow Id, using same workflowId we can fetch output. Example URL http://localhost:8080/api/workflow/dfa77699-a3b9-4c20-9339-42d4762d5f34.

For second question, conductor support that, but to understand better please post your workflow structure and will identify a solution.

gsambasiva avatar Jun 21 '18 07:06 gsambasiva

image4 this is my workflow, I have 2 http task defined. tt1 and tt2. I have a requirement that I have to get the json response from tt1 and modified the response( like appending , formatting, deleting some data from json), and this modified json I have to input to tt2 as body. is it possible

veveeran avatar Jun 21 '18 07:06 veveeran

Yes, It is possible.

public TaskResult execute(Task task) {

}

This is the method you should implement and can get the input data as task.getInputData(); . This will be a Java Map object with underlying data as JSON. You can use Jackson JSON libraries to extract, enrich and transform the data

jvemugunta avatar Jun 26 '18 13:06 jvemugunta

If the response need not be modified - could we skip the execute task implementation and directly use tt1.output.response.body.<key> would it work? Will it work in memory?

sudvarma avatar Jul 03 '18 13:07 sudvarma

@jvemugunta Thanks for the response.

@sudvarma You would still need to implement the execute() method and within this method, you can set the status of the task and also the output of the task.

apanicker-nflx avatar Feb 05 '19 01:02 apanicker-nflx