cancel
Showing results for 
Search instead for 
Did you mean: 

How using Ejbs (3.0) in Service-Tasks

mcdroemmel1
Champ in-the-making
Champ in-the-making
Hello,
an anybody help me how to use EJBs in Activiti?

regards
McD
4 REPLIES 4

bmr2012
Champ in-the-making
Champ in-the-making
+1
it would be nice if we could use EJB in Activiti.

meyerd
Champ on-the-rise
Champ on-the-rise
Hi Guys,

if you have Java EE 6, you can use the activiti-cdi extension to call EJBs using Expression Language.

If you do not have CDI, you can use plain JavaDelegate Objects and lookup an instance of your EJB from JNDI.

You could even write a generic EJB resolver that can be parameterized with things like
* JNDI name,
* Interface name,
* method name,
* parameters


The reason we do not provide such "resolvers" in activiti is that there are just too many ways to do this and the way you will eventually do it will be specific to your environment and individual requirements (security, classloading, transctions etc…)

mcdroemmel1
Champ in-the-making
Champ in-the-making
Hello meyerd,

i think using a JavaDelegate-Object would be a possible way.
And what do you think about triggering a running process (or waiting in activiti for an event) from a bean?
Would you recommend using a rest-ws from inside the ejb or is there something more smoother?

regards
Matthias

meyerd
Champ on-the-rise
Champ on-the-rise
I would always use the java API RuntimeService, RepositoryService etc… unless there is a very good reason not to do it. (Depends on you deployment setting, of course).

So if you have an EJB and want to start a new process instance, you can simply do a runtimeService.startProcessInstanceByKey(…)
Now, the tricky part is of course, where is the runtimeService instance coming from Smiley Happy