Difference between Connector tab Output parameter vs Input/Output tab Output parameter?

Difference between Connector tab Output parameter vs Input/Output tab Output parameter?
refer attached screenshot or refer camunda modeler
I read documentation for both Connector and Input/Output tabs (refer Camunda Modeler)
but I cannot infer the differences between them?

In what scenarios I need to use Connector tab Output parameters?
My understanding: whenever we make http call, once we get the response
we store http response in Connector tab Output variable(s)
JSON.parse(connector.getVariable(‘response’));
so that we can refer response object further down in other script tasks or service tasks using output variable (response1) with in that bpmn file

In what scenarios I need to use Input/Output tab Output parameters?
My understanding is not clear on this

Are there any best-practices and do’s and don’ts that I need to be aware of?
when to use Input/Output tab Output parameters vs Connector tab Output parameters


refer to this link

Input parameters for connector can be method, url , payload , headers etc This is used to pass values to the connector and its scope is limited to the connector only. here “Type” can be Script, Text etc. when you select Text as type you can hardcode the value or even use process variables
For example :
Name : url , Type : Text , value : ${url} if it is a process variable or hardcoded value like “http://…”
Name : url , Type : Script , value : an external file like deployment://formUrl.js or an inline javascript. This is a convenient way to form the url.

Output parameters for connector can be used to extract the response object to a variable. Lets if you want to extract status code from response to a variable. Then create a variable called “statusCode” ,Type as “Script”, write the appropriate logic inside to extract status value from implicitly available “connector” object.

Input /Output parameters for the task for the task are another layer of mapping (A gateway to/from the task), which is mostly useful while using call activities. Here also use can move the url formation logic to input mapping. For example

Name : url , Type : Text , value : http://sample.com/payTax/2020/${taxId} then use this in connector input variable like Name : url , Type : Text , value : ${url}.

Output parameter value’s scope will be limited to the process instance.

Hope this will help!

1 Like

@prasadps thanks for your reply.
I got your explanation, but it does not work how you explained for my use-case

I am attaching bpm file for your reference

In my use-case there are 2 service tasks
1st service task is making an http call (POST) and getting the response and storing the response in connector output parameters(response1)
2nd service task (In general tab, with Asynchronous Continuations : Asynchronous Before and Exclusive) is making an http call (POST) by constructing request payload from 1st service task response(response1)

Question 1: The problem is, in 2nd service task I am not able to get response1(response from service task1), always it shows null
Resolution : If I am storing the response1 into input/output (Output Parameters), then I can read response1 in service task2

Question 2 : In Service Task2 if I remove (in general tab uncheck Aysnchronous Before and Exclusive) then I can read respone1 which is set connector output parameters

Still I am confused between Connector output parameters vs Input/Out output parameters
What is the significance of Aysnchronous Before and Exclusive?

diagram_1.bpmn (4.1 KB)

Lets think connector as separate process. When you pass some input parameters to the connector, you are actually creating new variables within the connectors scope. The required input parameters and the available output parameters depend on the connector implementation. For example http-connector requires url,method,payload etc as the input parameters. So you need to pass them so that it will create those variables in connector’s scope. After the execution of the connector, an implicit object “response” will be available but in connectors scope. So you need to make it available as a process variable in the calling process instance (process instance with two service tasks). Output parameter of the connector makes this happen. Since you made response1 as output parameter it will be available in the further execution and service task 2 will be able to access it.

You can introduce a user task after every service task and inspect the process instance variables and scope once it reaches the user task.

  • Input parameter of the service task will introduce a local variable in the activity scope (here service task).

Suppose URL is available as process instance variable “prodUrl”. Then in service task2 you can pass it as url to the connector by adding input parameter with name as url and value as ${prodUrl}.

  • Output parameter of service task will introduce a variable available in the process instance scope ie outside of activity.

  • When you check “Async Before” it will spin up a new thread and execute it asynchronously. If you check “exclusive” then if there are other asynchronous tasks it will execute one by one.