6 Replies Latest reply on Sep 1, 2007 3:54 PM by paul williams

    Help on Best Practice

    paul williams Newbie

      Hi,

      I'm looking for some guidance on best practice with jBPM; I have a scenario where a process forks into two nodes that perform some business validation by calling separate independent services before returning and continuing the process flow.

      My question concerns the reporting of business exceptions thrown by the services; I need to return the exceptions (note the plural) to the UI layer, which in this case is a web page.

      What is considered to be best practice in this scenario? Should I be using process variables to hold the exceptions or use some other approach?

      Any guidance would be greatly appreciated.

      Reagrds,
      Paul.

        • 1. Re: Help on Best Practice
          Ronald van Kuijk Master

          If did the latter once, not because it is a good practice, but just because it worked and did not look to bad as an implementation

          • 2. Re: Help on Best Practice
            paul williams Newbie

            Ronald,

            Thanks for the reply.

            I'm wrapping my calls to jBPM in a stateless session bean so if I want to pass back any validation exceptions I would need to return the exceptions from the process variables as an array rather than just throwing an exception from the method.

            Alternatively, I guess I could create a custom exception that contained multiple validation exceptions and throw that from the method.

            What was your experience of implementing this type of handling?

            Regards,
            Paul.

            • 3. Re: Help on Best Practice
              Jim Barrows Newbie

              I believe that getting exceptions in the process, for any reason, is a part of the process. It makes sense to make error handling part of that process.

              • 4. Re: Help on Best Practice
                paul williams Newbie

                Hi Jim,

                So what approach would you advocate in passing business-level exceptions back to the UI Layer?

                Regards,
                Paul.

                • 5. Re: Help on Best Practice
                  Ronald van Kuijk Master

                  well, there are differences between engine exceptions and businessservice exceptions. The latter in our case were stored in specific processvariables called error__<seq#> they were used to direct the process (e.g. decisionnodes) to nodes where appropriate action could betaken. So that is kind of what I think Jim means by making it part of the process.

                  It would be nice to get this in a full example though but I'm still waiting for the jBPM book to arrive, might be something in there.

                  • 6. Re: Help on Best Practice
                    paul williams Newbie

                    Ronald,

                    Do you mean the Business Process Management with JBoss jBPM book by Matt Cumberlidge? I've just finished reading it and it gives a very good overview on both BPM and jBPM with a good starter application. I would have liked to seen more developer oriented topics discussed in greater depth but given the stated audience of the book I guess that wasn't possible.

                    In my scenario, I need to pass business-level exceptions back immediately after some validation (from the process to the UI layer) within the context of a conversation with a user; I'm using the process as a kind of orchestration mechanism. There are wait states later in the process but the validation step is the first.

                    My initial thoughts were to create a generic exception similar to SQLException where I could set a code for each business level error and then wrap a collection of these in another exception which would be thrown by my stateless session bean wrapping the jBPM engine.

                    Regards,
                    Paul.