Hi,
I use camunda 7.15 with wildfly 20.
I have got a process application (so I have got no ejbs). I want that a service task calls a method in my corresponding bean.
Calling the execute() method is possible when I use this from my service task:
public class ThesisWKBusinessLogic implements JavaDelegate{
public void execute(DelegateExecution execution) throws Exception {
getThesisWorkerViaREST(execution);
}
That works. But I want to use several methods like it is possible with ejb.
I tried the following:
Using Delegate Expression (I also tried Expression) in Service task
@BusinessProcessScoped
public class ThesisWKBusinessLogic implements JavaDelegate,Serializable{
...
public void testBeanAccess(DelegateExecution execution) throws Exception {
System.out.println("Zugriff auf Methode über CDI erfolgreich");
}
But it does not work, I think I did not understand the concept. Can anyone please help me?
Thank you,
Nicole
we’re using different versions of Camunda on different Wildfly servers (10,16,…) for years.
To already existing EJB SessionBeans we simply added the javax.inject.Named annotation to use them via CDI from Camunda Service Tasks.
By default the name of the CDI managed bean is the name of the class with first letter in lower case, but if you like you can give it your own name, e.g. when there are two classes with same name in different packages (@Named(“aDifferentNameYouLikeMore”)).
Example:
@Stateless
@Named
public class SalesOrder extends ...
{
...
public void printPickingDocument_sla( final DelegateExecution execution )
{
...
}
}
A Tomcat has no context by default, you should provide one with a framework (Google Guice maybe).
To use expressions that can be resolved inside your (custom) context, you can extend the org.camunda.bpm.engine.impl.el.ExpressionManager to serve your needs.
org.camunda.bpm.engine.spring.SpringExpressionManager is the implementation that is used inside the spring boot impl.
This expression manager is the bridge from your provided expression to the context that you use.