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
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?
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.
Joined: Apr 07, 2011
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!
subject: workflow implemetation with stateful session bean