13 Replies Latest reply on Aug 27, 2009 3:22 AM by jbarrez

    How to control process transition in JBPM 4.0?

      Hello everybody, I have a question. I am trying to implement my web application activity into JBPM. That means when user move from one screen to other screen I want to move from one task/state to other. Now suppose user is on first page ie. he entered in first task/stage of process, call the java component get the return value and display output on the page. Here, I don't want process to do transition from first state to another unless user make move to next page. In short, how can i stop my state to stop transition unless call is made by user activity from web application?
      Please advise if whatever I have explained is possible and how it can be achieved.
      Appreciate your response.
      Thanks
      Yukon

        • 1. Re: How to control process transition in JBPM 4.0?
          mmusaji

          I'm just starting out using JBPM but from what I know I guess you'll need some sort of event-listener. If you check out the User Guide for JBPM 4.0 it should give you some hints.

          Someone more experienced maybe able to give you a better example perhaps.

          • 2. Re: How to control process transition in JBPM 4.0?
            kukeltje

            Don't try to put *everything* in the process. Sometimes it is better to use e.g. ui technoglogy (jsf/gwt/...) e.g. use seam pageflow in a task and only on the last page 'end' the task

            • 3. Re: How to control process transition in JBPM 4.0?

              Does that mean JBPM does not allow me to interrupt between the transition of two states/tasks of the process flow?
              I understand we have "signalExectution", but that helps me only when I want to signal back my state/task. Per my understanding event listeners are used to trigger external components from your state/task. They do not control the transition. Not sure, again, experts may throw some light.

              Ronald, I truely appreciate your comments. Now a days everybody wants to use JBPM, and it is very crucial/important to know for any JBPM user to understand whether his requirement is fit for JBPM process flow.
              Do you think my situation is fit for JBPM?

              Thanks

              • 4. Re: How to control process transition in JBPM 4.0?
                kukeltje

                If with 'interrupt' you mean do something on the transition, I'm not sure anymore for jBPM 4. In 3 you could but few people used it afaik.

                Eventlisteners can do whatever you want them to do but *only* on business process events. Not while filling out a form and putting a specific value in a formfield. That is more seam pageflow like of jsf/ajax with backingbeans (your java class).

                Sure you could put generic eventlisteners in jbpm and while filling out a formfield send a specific event that does things etc,, but it really complicates things.

                Since I have to little detail on what your complete application needs to do it its hard to say yes or no, and even if it is crucial/important for others to know. The latter simply because jBPM 4 did not change that much from jbpm 3 in this regard and we never had this question before. Again, don't try to put *everything* in the processdefinition. Seam has pageflow for a reason!

                http://docs.jboss.org/seam/2.1.1.GA/reference/en-US/html/jbpm.html

                • 5. Re: How to control process transition in JBPM 4.0?

                  Thanks for the response.
                  To explain my problem in more detail ... What I am planning to do is ...

                  1. I have a web application say 3-4 screens. I have created JBPM flow as one page backend code as one process state.

                  2. I don't want to tie up my UI with JBPM. When user clicks on first page, backend java component will be called through JBPM.

                  3. Like, first screen "submit" button will initiate the process, and calls the class mentioned in first java task with proper input and receive response.

                  4. Now I send this output to the user screen (my first state/task is complete).

                  5. Here I want transition from first state/task to second state/task to be on hold till user moves to second screen.

                  Do you think this is possible? So far I have not seen anything in JBPM API which can hold process from transitioning once state/task is over.

                  Thanks

                  • 6. Re: How to control process transition in JBPM 4.0?
                    jbarrez

                    This is quite easy to implement if you use the transitions as a 'button' for going to every screen; ie. on the second screen your process is halted until the button is clicked, which will signal the process.

                    I don't see anything out of the ordinary in this use case, or am I missing something?

                    • 7. Re: How to control process transition in JBPM 4.0?

                      Thanks! you gave me good hope to continue with what I was doing... The reason I was worrying is there is nothing in the jbpm example project that halts execution during transition. Can you please help me on that? Here I am explaining the scenario I am going to implement...

                      1. From my UI project I call a component which initiate a process.

                      2. Where I take instance of ProcesInstance then ExecutionService, calls startProcessInstancebyKey ...

                      3. now my process returns me object which I pass to UI project along with processID to display data on the web page.

                      4. and when user takes next action on web page I pass this processID back and get another ProcessInstance or retrieve old instance and call executionService.signalExecutionById(pid).

                      According to you this should work? What do I need to change in jpdl so that transition will halt?

                      Thanks

                      • 8. Re: How to control process transition in JBPM 4.0?
                        kukeltje

                        states/nodes/tasks will hold, transitions won't. There is an example in the source that uses tasks and 'holds'

                        from what I read now, everything you want is basic jBPM. Only in 4 you might (as Joram suggests) e.g. and a task and not generally signal the execution. But look a little more at all the examples.

                        • 9. Re: How to control process transition in JBPM 4.0?

                          I think you do not read the text in the thread and reply out of your addition. I have asked something in my post. If you do not have relevant answer please do NOT confuse me (like you did with my other threads). I am new to JBPM and want to understand it. You may find my questions very basic and stupid, but I think that is why ppl go to forum.

                          Thanks for your response though.

                          Thanks

                          • 10. Re: How to control process transition in JBPM 4.0?
                            kukeltje

                            Ok, it is up to you. Here is my last response:
                            - Where did I not read the thread? I read *all* threads, Maybe it was *you* who caused initial confusion by not explaining clearly enough. And even that is not a problem, since for many people (including me) English is not their native language and sometimes causes confusion.
                            - Why do *you* think something is *not relevant* if you do (at least not yet) show understanding of basic bpm (not even jBPM) things.
                            - Where did I confuse you? The other post in the *wrong* forum? What other threadS (I multiple times confused you? wow)
                            - Your question is (after a lot of additional explaining) basic but *not* stupid, I never said that *anywhere* and I never will.

                            Oh, and regarding the 'kind' in my signature:
                            I help a lot of people, out of free will. Sometimes some people who do not get what they want, react in a way that is described in the same article I pointed you to in the other forum: http://catb.org/~esr/faqs/smart-questions.html#keepcool
                            And then they blame me of being rude... therefore the explicit 'kind' in the signature. Since I am kind

                            In this other forum, I even said I would be happy to elaborate here, even after you used a wrong forum, hijacked a totally unrelated threat and after me pointing that out to you continued and even asked for help via private mail. No instead of appreciating that and continuing in this topic you closed the door on that (the thanks in the end does not count)

                            So again, best of luck with using jBPM, a great tool and by getting help (from others)

                            • 11. Re: How to control process transition in JBPM 4.0?

                              Dear Ronald, I am really sorry if I have hurt you. I did not intend to hurt you or anybody.

                              Thanks for all your help.

                              Thanks

                              • 12. Re: How to control process transition in JBPM 4.0?

                                My puzzle still not resolved. I got another problem while working on use case i have explained earlier in the same thread.
                                I have a process with two java task one after another... Both takes input values and return some object.
                                Now, per my use case one UI page calls one Java task of the process. First web page calls to first java task but, when I do startprocessInstanceByKey("name",variables); it throws exception shouting for input arguments for second java task, and can not proceed further. But, when I am at first page I do not have input ready for the class mentioned in second java task. The input for second task comes from the second web page.

                                Can you experts throw some light ...

                                Appreciate your help.

                                • 13. Re: How to control process transition in JBPM 4.0?
                                  jbarrez

                                  Ronald has pointed out already that your process will always continue if you use a 'java' task. It's not for nothing the 'java' task is listed under automatic activitites.

                                  If you want to halt process execution, you need to use wait states or tasks. These will halt your process until you trigger them to continue.