Hi,I'm trying to find a way of modifying certain task expressions at deploy time. I figured I could define expressions with a custom syntax in my BPMN and then modify them at deploy time to "wrap" them in a proper expression. I guess it would be a kind of poor-man's way of making custom remote service calls.For example, I'd like to be able to transform this (representative syntax only):
<serviceTask expression="http://endpoint" />
into this:
<serviceTask expression="${delegator.invoke('endpoint')}" />
where delegator
is a regular Spring bean.I tried to modify expressions with a custom BpmnParseHandler
, but it didn't work. Here's the code I tried:
public static class CustomServiceTaskHandler extends AbstractBpmnParseHandler<ServiceTask> {
@Override
protected Class<? extends BaseElement> getHandledType() {
return ServiceTask.class;
}
@Override
protected void executeParse(BpmnParse bpmnParse, ServiceTask element) {
element.setImplementation("${nonexistentBeanName}");
}
I would expect this to trigger an error at runtime, but the task expression doesn't actually seem to be really modified. The original, unmodified expression is still there in the deployed process. I suppose I'm either too late or too early in the parse process, or I completely got the wrong idea.Is there a way I can get this to work? Or do you think there's an entirely different/better way I can implement this kind of thing? A bit of background on my setup: I run an Activiti engine as a service, and my clients deploy their processes remotely from their own applications, implemented as microservices. I would like my clients to be able to specify REST URLs directly inside their expressions, as they cannot import Spring beans directly into my JVM.