aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes workflow implemetation with stateful session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "workflow implemetation with stateful session bean" Watch "workflow implemetation with stateful session bean" New topic
Author

workflow implemetation with stateful session bean

Viktor Horváth
Greenhorn

Joined: Apr 07, 2011
Posts: 3
Hi!

I would like to implement a worklflow and I want to use stateful session bean.
So the worklfow rather complicated, this has to do some steps and wait for some events, make some decisions, wait again and so on. There is one workflow logic but more workflow instances have to run simultaneously. I want to implement the workflow logic by a stateful session bean and I need more running instances of this stateful session bean (SFSB). A message driven bean (MDB) will start the workflows and handles the events (the workflow will exit from waiting if a proper event has happened from outside (MDB) ).
The logic of workflows are the same but they differ in some attributes (for example: country). I try to paint this in text

outside world    -->              facade                    -->  workflow HUN (stateful session bean)
(Java client)            (stateless session bean)
                                                                           --> workflow GB (stateful session bean)

                                                                           --> workflow ...

Something like this. So "the outside world" will start workflows through facade. "The outside world" can tell which sort of workflow it wants to start. After some steps the workflow will wait for an event. If the event will happen (I don't know where or when, this is transparent for my workflow) "the outside world" will notify the facade and the facade must find the right workflow to call its method. As You can see above more workflows (so more stateless session bean) must run simultaneously.
In this case how I could find the right workflow storing the reference? (I thought of storing the references of SFSBs in a Map:


Ok, this might not be a good solution but could You please recommend me a good one?
)

Could You please help me?

Thanks!

V.
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

Please try to re-implement your solution using the "Service Locator" pattern.


S.D. MADHAN
Not many get the right opportunity !
Viktor Horváth
Greenhorn

Joined: Apr 07, 2011
Posts: 3
Hi Madhan,
thank You for your reply!
But in this case I would store the references of stateful session beans as well, wouldn't I?
V.
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

Yes. To optimize further, you may add lazy-loading pattern too, to load the service that is required only at a given point of time.
Viktor Horváth
Greenhorn

Joined: Apr 07, 2011
Posts: 3
I have found a solution but it wasn't very good either... We have cluster environment with 2 managed server (weblogic).
As I know the stateful session bean will work on one of the nodes (and not both). But how will the clients know which node they can use? And how can I set this node at lookup?
It is now a very serious problem for me, I cant see any solution...
Thank You very much!

V.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: workflow implemetation with stateful session bean