[jBPM Users] - Re: Models of integration with JMS
by jbarrez
anonymous wrote : I have found no reference to JMS integration, so I expect I would have to write an application which listens for incoming messages, decodes them, and invokes the appropriate jBPM workflow.
Correct. Basically you need a MDB that listens to your queue/topic and calls the jBPM service. I've seen this scenario multiple times out in the wild. jBPM is 'just a jar' and as such we don't ship it with JMS listeners etc.
anonymous wrote : Which brings me to the second question, how do you internally have workflows respond to a common event. ie, I want to allow workflow developers to deploy multiple workflows which all respond to a new file event. Is this possible, or would I have to launch all of the required workflows from my service, which would mean knowing which workflows need to be executed.
Unfortunately, there is no such thing currently in JPDL. I know that it a use case which tends to pop up sometimes - and it is also defined in BPMN2 spec... so my current approach would be to attach in some way or the other metadata (perhaps using the process definition key - prefixes or something) to the process definitions, which is used when such an event is received.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263572#4263572
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263572
16 years, 5 months
[jBPM Users] - Re: EventListener questions
by jbarrez
Sebastion,
anonymous wrote : I have got a question regarding jBPM's behaviour. Assuming I have a transition coming from a user task and I put an EventListener on this transition: When the transition fires and the EventListener is notified and executes is the task already to be found as a HistoryTask? I am asking because I would like to access the task object to retrieve some information.
Conceptually I would say yes: it is only when the task is completed (and history is saved) that the transition is taken. Since the same Hibernate session is used when taking the transition, it could be not yet persisted but you'll find it anyway through the session.
However, I did not test this, the only thing you can try is test it :-)
anonymous wrote : My second question: Is there a way to obtain a reference to the HistoryService or TaskService? Or is there a different way to access the task object?
The easiest would be to inject the ProcessEngine or to store the ProcessEngine somewhere application-wide to retrieve the services.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263567#4263567
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263567
16 years, 5 months
[jBPM Users] - Re: Timer throwing exception intermittently
by sridhar18
Sure. Thanks for the response. You could use the below process defnintion and EventListener class to try to reproduce this:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <process name="MyWorkflow" xmlns="http://jbpm.org/4.0/jpdl">
|
| <start g="11,265,80,40">
| <transition to="fork"/>
| </start>
|
| <fork g="76,263,80,40" name="fork">
| <transition to="ValidateOne"/>
| <transition to="ValidateTwo"/>
| </fork>
|
| <state g="138,450,127,52" name="ValidateOne">
| <on event="timeout">
| <timer name="checkValidityForOne" duedate="3 minutes" repeat="2 minutes"/>
| <event-listener class="some.class.CheckValidityOneEvent">
| <field name="idType"><string value="ID_ONE"/></field>
| </event-listener>
| </on>
| <transition g="-72,-22" name="valid" to="complete"/>
| <transition g="-72,-22" name="invalid" to="end"/>
| </state>
|
| <state g="138,450,127,52" name="ValidateTwo">
| <on event="timeout">
| <timer name="checkValidityForTwo" duedate="4 minutes" repeat="5 minutes"/>
| <event-listener class="some.class.CheckValidityTwoEvent">
| <field name="idType"><string value="ID_TWO"/></field>
| </event-listener>
| </on>
| <transition g="-72,-22" name="valid" to="complete"/>
| <transition g="-72,-22" name="invalid" to="end"/>
| </state>
|
| <join g="706,212,48,48" multiplicity="2" name="complete">
| <transition to="end"/>
| </join>
|
| <end g="779,213,48,48" name="end"/>
| </process>
|
It just has a fork, two concurrent activities (events), and a join.
My sample event listener class:
| @SuppressWarnings("serial")
| public class CheckValidityOneEvent implements EventListener {
| private final Logger log = Logger.getLogger(this.getClass());
|
| @Override
| public void notify(EventListenerExecution execution) throws Exception {
| try {
| // business logic, check for condition
|
| // if condition met, signal execution by id
| executionService.signalExecutionById(execution.getId(), "valid");
|
| // otherwise, do nothing
| } catch (Exception ex) {
| // catch all exceptions and don't rethrow them.
| log.error("Exception occured: " + ex.getMessage());
| }
| }
| }
|
So on each timeout, the timer will perform a check and transitions to valid only if the check is successful. Otherwise it does nothing. I won't throw any exceptions up the chain.
I have my .bar and library jar deployed to jboss 5.1 GA. Let me know if you need anymore information.
Thanks.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263552#4263552
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263552
16 years, 5 months