Hello Flowable team!
I’m trying to inject and use a Quarkus @ApplicationScoped bean in the following class implementing JavaDelegate:
@ApplicationScoped
public class TestDelegate implements JavaDelegate {
Logger logger = Logger.getLogger(this.getClass().getName());
@Inject
TestService testService;
@Override
public void execute(final DelegateExecution execution) {
logger.info("TestService says: " + testService.test());
}
}
TestService is a very simple @ApplicationScoped bean:
@ApplicationScoped
public class TestService {
Logger logger = Logger.getLogger(this.getClass().getName());
public String test() {
return "Thanks for calling me!";
}
}
I’ve tried the following BPMN configurations and none of them seems to be working.
Config 1
<serviceTask id="externalSystemCall" name="Enter holidays in external system"
flowable:class="full.package.name.TestDelegate"/>
This configuration throws a NullPointerException on testService.test() as testService is null.
Config 2
<serviceTask id="externalSystemCall" name="Enter holidays in external system"
flowable:expression="${testDelegate.execute}"/>
This configuration throws a org.flowable.common.engine.api.FlowableException: Unknown property used in expression: ${testDelegate.execute} with Execution[ id ‘26’ ] - definition ‘holidayRequest2:1:6’ - activity ‘externalSystemCall’ - parent ‘22’\r\n\tat org.flowable.common.engine.impl.el.JuelExpression.getValue(JuelExpression.java:54)
Config 3
<serviceTask id="externalSystemCall" name="Enter holidays in external system"
flowable:delegateExpression="${testDelegate.execute}"/>
This configuration throws a org.flowable.common.engine.api.FlowableException: Unknown property used in expression: ${testDelegate.execute} with Execution[ id ‘35’ ] - definition ‘holidayRequest3:1:9’ - activity ‘externalSystemCall’ - parent ‘31’\r\n\tat org.flowable.common.engine.impl.el.JuelExpression.getValue(JuelExpression.java:54)
Config 4
<serviceTask id="externalSystemCall" name="Enter holidays in external system"
flowable:delegateExpression="${testDelegate}"/>
This configuration throws a org.flowable.common.engine.api.FlowableException: Unknown property used in expression: ${testDelegate} with Execution[ id ‘44’ ] - definition ‘holidayRequest4:1:12’ - activity ‘externalSystemCall’ - parent ‘40’\r\n\tat org.flowable.common.engine.impl.el.JuelExpression.getValue(JuelExpression.java:54)
Would you have ideas about how to solve this? Or are Quarkus beans not supported yet?
Thanks in advance for your help!