Where runtime options have been set in the owner of a collaborative process, they may need to be sent to a partner when the partner is created.
This can be achieved using a small number of conventions.
In the owner's send step, set "initData" to "@{call:getPartnerInit?}". The @ is conventionally used as the placeholder character for send. getPartnerInit? means "call getPartnerInit, but don't raise an error if not found".
This getPartnerInit builds the full object to be passed as initData by aggregating all partnerInit.* steps into named properties. The responseMode of "object" means this collects all these in an object the properties of which are the names of the step after "partnerInit.".
{
"name": "getPartnerInit",
"script": "call",
"config": {
"callAction": "partnerInit.*",
"returnMode": "object"
},
"next": false
}Each data item that the partner needs requires a "partnerInit.name" step. This can use the placeholder defined for Process module runtime configuration.
{
"name": "partnerInit.fooBar",
"script": "getData",
"config": {
"data": "${fooBar}"
},
"next": false
}This example means that the init data sent to the partner will contain an object with a "fooBar" property set to whatever the owner thinks that "fooBar" is (which is actually a call to get_fooBar, which will return fooBar from configuration options or from a default).
Lastly, the options need to define for the partner where to get their copy of the data from. We do this by setting a component option for the partner to a runtime option that the partner will use to find the data (i.e. the "fooBar" property of the "init" data area.)
{
"partner": {
"fooBar": "%{data:init.fooBar}"
}
}Any partner references to ${fooBar} will then resolve via the runtime option, which pulls the value from the initData area.