[jboss-user] [JBoss jBPM] - Re: How to best control access from multiple threads to a Pr

jse do-not-reply at jboss.com
Fri Dec 19 01:44:20 EST 2008


Ronald

I am fairly new to jBpm and am just looking for the appropriate "jBpm way" of solving the problem.

I think, perhaps, my first post was a bit too abstract to be clear. So... here is a more concrete example.

Lets envisage that jBpm (J) is responsible for escalating a problem with external system P. The means of escalation is email, using external emailing system E. All interaction with the external systems is via http. E(mail) will provide J(bpm)  with delivery notification and read receipt information via http callbacks. These delivery notfifications and red receipts need to be sent to the P(roblem) system via http callback. So... as a sequence diagram we have:


  |           P             J               E
  |           |
  |       
  |           |
  |           |--http post-->|
  |                          |
  |                     (thread J1)
  |                          |
  |                          |--http post-->|
  |                                         |
  |                          |<---200 OK----|
  |                          |
  |           |<---200 OK----|
  |           
  |           
  |                                         | (recv delivery receipt)
  |                          |<--http post--|
  |                          |
  |                     (thread J2)
  |                          |
  |           |<--http post--|
  |           |
  |           |----200 OK--->|
  |                          |----200 OK--->|
  |                          
  |                          
  |                          
  |                                         | (recv read receipt)
  |                          |<--http post--|
  |                          |
  |                     (thread J3)
  |                          |
  |           |<--http post--|
  |           |
  |           |----200 OK--->|
  |                          |----200 OK--->|
  | 

This could be modelled in jBpm like this


  | 
  |      start
  |        |
  |        |
  |        V
  |     send email via http
  |        |
  |        |
  |        V
  |     wait for delivery receipt
  |        |
  |        |
  |        V
  |     send delivery receipt via http
  |        |
  |        |
  |        V
  |     wait for read receipt
  |        |
  |        |
  |        V
  |     send read receipt via http
  |        |
  |        |
  |        V
  |     end
  | 

The challenge here is that if Thread J2 gets blocked (perhaps because system P is a bit slow), and thread J3 receives the read receipt whilst thread J2 is still in progress, I need to ensure that thread J3 does not acquire the process instance until thread J2 has released it.

I think that you are saying that I could model this in a different way, using tokens to ensure that the two async events are handled correctly (i.e. thread J2 will signal the "delivery" token and thread J3 will signal the "read" token. For example:



  | 
  |                         start
  |                            |
  |                            |
  |                            V
  |                         send email via http
  |                            |
  |                            |
  |                            V
  |        +------------------fork------------------+
  |        |                                        |
  |        V                                        V                 
  |     wait for delivery receipt                wait for read receipt
  |        |                                        |
  |        |                                        |
  |        V                                        V
  |     send delivery receipt via http           send read receipt via http
  |        |                                        |
  |        |                                        |
  |        +------------------join------------------+    
  |                            |
  |                            |
  |                            V    
  |                           end
  | 

Have I understood you correctly?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197517#4197517

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4197517



More information about the jboss-user mailing list