cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti-OSGi dynamically add ActivityBehavior

ronnybr
Champ in-the-making
Champ in-the-making
Hello,

I have a process which uses its own ActivityBehaviour in an OSGi-environment.
When I deployed the process definition I discovered that there is no way to add custom behaviors in an OSGi/Blueprint-like way.

Right now I solved the problem by extending the BlueprintELResolver (as you can see here).

I guess adding/removing behaviors could be useful for other people, too. Because of that I suggest to add methods to the BlueprintELResolver to handle it.
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
Indeed it would be valuable.

What would be the 'blueprint' way to fix this? We've got some custom classloading utils already in there that fix most osgi problems we had.

ronnybr
Champ in-the-making
Champ in-the-making
Well, I am no blueprint expert, that's why I would take the same approach you took with dynamically adding the JavaDelegates.
A pair of bind/unbind methods and declare the ELResolver as listener like this in a context.xml:
<code>
<reference-list id="activityBehaviours" availability="optional"
                interface="org.activiti.engine.impl.pvm.delegate.ActivityBehavior"
                activation="eager">
                <reference-listener ref="blueprintELResolver"
                        bind-method="bindBehaviour" unbind-method="unbindBehaviour" />
        </reference-list>
</code>
Adding a new behaviours would result in exposing them as a service via another context.xml.