History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: JBSEAM-2951
Type: Feature Request Feature Request
Status: Closed Closed
Resolution: Done
Priority: Minor Minor
Assignee: Norman Richards
Reporter: Samuel Mendenhall
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Seam

Add ability to start jBPM in the wait-state instead of only the start-state

Created: 06/May/08 11:33 AM   Updated: Thursday 09:21 PM
Component/s: BPM
Affects Version/s: None
Fix Version/s: 2.1.0.BETA1

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Help Desk Ticket Reference: https://enterprise.redhat.com/issue-tracker/177689


 Description  « Hide
"jBPM itself does work as stated in the *jBPM docs*, i.e. start-state behaves as a wait state. It is Seam who signals the process instance right after it is created, effectively disabling the wait behavior of the start-state.

The intent of giving the start-state a wait behavior is to allow the caller to set variables or complete a user task prior to executing any action in the process.

Seam should offer a way to create a process instance without signaling it right away. Changing the behavior to leave the signal() out would break existing applications who assume that the process instance immediately moves to the next step. To deal with this, Seam could add a createProcess(ProcessDefinition, boolean) method to the BusinessProcess class. The boolean parameter tells whether the process instance is to be signaled." --Alejandro Guizar

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order:
Norman Richards [06/May/08 02:34 PM]
 We can add to the APIs, but I'm curious how the user would signal the process and whether whether or not we need to flush the business process context? Is there any reason you can't simply create the process and just call BusinessProcess.setProcessId()?



Alejandro Guizar [08/May/08 01:16 AM]
The user could signal the newly created process by calling BusinessProcess.transition() once any custom initialization activities have been performed. You can certainly create the process by hand as the user did (see the case), but it feels dirty.

Instead of the new method I proposed earlier, it'd be good that jBPM and Seam had consistent process creation behaviors. It'd be less surprising for our users who are familiar with both products. We can choose to signal on creation or not, but we should do it consistently.

There is one advantage to not signaling. If you do not require initialization, you can always signal immediately:

Seam: businessProcess.createProcess("my proc"); businessProcess.transition("go");
jBPM: jbpmContext.newProcessInstance("my proc").signal("go");

With signal on creation, there is no way to perform any initialization.

Norman Richards [08/May/08 11:07 AM]
Seam does do initialization. It dumps all the business process scoped data into the process.

Norman Richards [08/May/08 11:12 AM]
I think the real sticky point here is in providing functionality on the component that isn't exposed via annotations or any of our other process control mechanisms. I really don't understand the use case well enough to know if we need to expose any of this behavior or to understand the implications in a Seam app of the user manually mucking with the process. Certainly Seam cannot mirror every piece of JBPM functionality and at some point if the user needs to do something really tricky they should probably be doing it themselves. Since you seem to think this is definitely something that needs to happen, I'll add the method in.

Norman Richards [08/May/08 02:39 PM]
It would be nice to get some feedback on whether or not the end result is what is expected.

Alejandro Guizar [08/May/08 09:21 PM]
I appreciate your quick response to this case. I just took a look at your additions [1]. I believe the user will find the addition useful.

On the other hand, you raise a valid point: the new functionality is not exposed via annotations, which will limit the value of the addition for other Seam users.

Given this limitation, I thought of a different solution which I'd like you to consider.

a) Forget about BusinessProcess.createProcess(String, boolean)
b) Have BusinessProcess.createProcess(String) and BusinessProcess.createProcess(String, String) *never* signal. => This would give processes in Seam the option to remain in the start-state, as in vanilla jBPM <=
c) Add an optional element "shouldSignal" to @CreateProcess, defaulting to true. BusinessProcessInterceptor.afterInvocation() would incorporate the additional element as follows.

            CreateProcess tag = method.getAnnotation(CreateProcess.class);
            if ( tag.processKey().equals("") )
            {
               BusinessProcess.instance().createProcess( tag.definition() );
            }
            else
            {
               BusinessProcess.instance().createProcess( tag.definition(), getProcessKey( tag.processKey() ) );
            }

            if ( tag.shouldSignalProcess() )
            {
               ProcessInstance().instance().signal();
            }

What do you think?

[1] http://fisheye.jboss.com/changelog/Seam/?cs=8143