Michał Minicki [
http://community.jboss.org/people/Valgoerad] created the discussion
"JBPM 5, WorkItemHandler as a Spring Bean"
To view the discussion, visit:
http://community.jboss.org/message/577346#577346
--------------------------------------------------------------
Hello. Is there a way to register domain specific work item handlers via Spring
configuration? There is an example in the manual on how to create such nodes:
https://hudson.jboss.org/hudson/job/jBPM5/lastSuccessfulBuild/artifact/ta...
https://hudson.jboss.org/hudson/job/jBPM5/lastSuccessfulBuild/artifact/ta...
But I would like to inject EmailService to NotificationWorkItemHandler via Spring instead
of doing this call:
EmailService service = ServiceRegistry.getInstance().getEmailService();
In order to do so, I need to register this handler as a Spring bean and iject it via
application context. My configuration at the moment is as follows:
<drools:kbase id="knowledgeBase">
<drools:resources>
<drools:resource type="BPMN2"
source="classpath:jbpm/churn/PodpowiadaczOfert.bpmn" />
<drools:resource type="BPMN2"
source="classpath:jbpm/simple01.bpmn" />
<drools:resource type="BPMN2"
source="classpath:jbpm/simple02.bpmn" />
<drools:resource type="BPMN2"
source="classpath:jbpm/simple03.bpmn" />
<drools:resource type="BPMN2"
source="classpath:jbpm/simple04.jbpmn" />
</drools:resources>
<drools:configuration>
<!--<drools:multithread enabled="true"
max-threads="5" /> -->
<!--<drools:consequenceExceptionHandler
handler="pl.cyfrowypolsat.workflow.SimpleException" /> -->
</drools:configuration>
</drools:kbase>
<drools:ksession id="jpaSingleSessionCommandService"
type="stateful" kbase="knowledgeBase">
<drools:configuration>
<drools:jpa-persistence>
<drools:transaction-manager ref="transactionManager" />
<drools:entity-manager-factory ref="entityManagerFactory"
/>
</drools:jpa-persistence>
</drools:configuration>
</drools:ksession> <drools:kbase id="knowledgeBase">
<drools:resources>
<drools:resource type="BPMN2"
source="classpath:jbpm/churn/PodpowiadaczOfert.bpmn" />
<drools:resource type="BPMN2"
source="classpath:jbpm/simple01.bpmn" />
<drools:resource type="BPMN2"
source="classpath:jbpm/simple02.bpmn" />
<drools:resource type="BPMN2"
source="classpath:jbpm/simple03.bpmn" />
<drools:resource type="BPMN2"
source="classpath:jbpm/simple04.jbpmn" />
</drools:resources>
<drools:configuration>
<!--<drools:multithread enabled="true"
max-threads="5" /> -->
<!--<drools:consequenceExceptionHandler
handler="pl.cyfrowypolsat.workflow.SimpleException" /> -->
</drools:configuration>
</drools:kbase>
<drools:ksession id="jpaSingleSessionCommandService"
type="stateful" kbase="knowledgeBase">
<drools:configuration>
<drools:jpa-persistence>
<drools:transaction-manager ref="transactionManager" />
<drools:entity-manager-factory ref="entityManagerFactory"
/>
</drools:jpa-persistence>
</drools:configuration>
</drools:ksession>
<drools:kbase id="knowledgeBase">
<drools:resources>
<drools:resource type="BPMN2"
source="classpath:jbpm/simple01.bpmn" />
</drools:resources>
<drools:configuration>
<drools:multithread enabled="true" max-threads="5"
/>
</drools:configuration>
</drools:kbase>
<drools:ksession id="jpaSingleSessionCommandService"
type="stateful" kbase="knowledgeBase">
<drools:configuration>
<drools:jpa-persistence>
<drools:transaction-manager ref="transactionManager" />
<drools:entity-manager-factory ref="entityManagerFactory"
/>
</drools:jpa-persistence>
</drools:configuration>
</drools:ksession>
How would I go about registering custom item handlers in the Session's
WorkItemManger?
ksession.getWorkItemManager().registerWorkItemHandler("Notification", new
NotificationWorkItemHandler());
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/577346#577346]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]