Dynamic <call> target in BPL
Hi all,
When making a Business Process reusable, I needed to make the target of a <call> configurable as a business host setting. This can be done through indirection. Here's how:
Property TargetConfigName As Ens.DataType.ConfigName;
Parameter SETTINGS = "TargetConfigName:Basic";
/// BPL Definition
XData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ]
{
<process language='objectscript' request='Ens.Request' response='Ens.Response' height='2000' width='2000' >
<sequence xend='200' yend='450' >
<call name='Call configurable target' target='@process.TargetConfigName' async='1' xpos='200' ypos='250' >
<request type='Ens.Request' >
<assign property="callrequest" value="request" action="set" />
</request>
<response type='Ens.Response' >
<assign property="response" value="callresponse" action="set" />
</response>
</call>
<sync name='Wait' calls='Call configurable target' type='all' xpos='200' ypos='350' />
</sequence>
</process>
}
Parameter SETTINGS = "TargetConfigName:Basic";
/// BPL Definition
XData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ]
{
<process language='objectscript' request='Ens.Request' response='Ens.Response' height='2000' width='2000' >
<sequence xend='200' yend='450' >
<call name='Call configurable target' target='@process.TargetConfigName' async='1' xpos='200' ypos='250' >
<request type='Ens.Request' >
<assign property="callrequest" value="request" action="set" />
</request>
<response type='Ens.Response' >
<assign property="response" value="callresponse" action="set" />
</response>
</call>
<sync name='Wait' calls='Call configurable target' type='all' xpos='200' ypos='350' />
</sequence>
</process>
}
Discussion (0)0
Comments
Hi @Otto Medin
very good point.
In order to get links visible on the production configuration, you can add this method :
/// Return an array of connections for drawing lines on the config diagramClassMethod OnGetConnections(Output pArray As%String, pItem As Ens.Config.Item)
{
Do##super(.pArray,pItem)
If pItem.GetModifiedSetting("TargetConfigNames",.tValue) {
For i=1:1:$L(tValue,",") { Set tOne=$ZStrip($P(tValue,",",i),"<>W") Continue:""=tOne Set pArray(tOne)="" }
}
}.png)
.png)
By using your code in this business process, using this production, you can get the following Visual Trace :.png)
.png)
Is there any way using that method to reference a class method call?
Perhaps. Could you expand on what you're trying to do?
Do you want to call a process, the name of which is returned by a method?
You can use indirection @, or assign method result to a local variable and use @ on it.