2 Replies Latest reply on Nov 2, 2007 7:56 PM by preitsma

    Passing ContextInstance as parameter to session bean ?

    preitsma

      Hi,

      I am reflecting a bit on the architecture of my JBPM driven back-end file processing application: I wrote a couple of stateless session beans that provide more or less atomic functions (methods). From the action handlers in my processes I make remote EJB calls to these methods. Every method call passes one or more process variables and modifies some.

      What annoys me in this setup is that I need to implement a separate ActionHandler for every process step that merely makes one method call passing one ore more process variables as parameters and and does some process variable modification.

      I would like to implement a generic ActionHandler that passes the ContextInstance (or VariableContainer) as a parameter to my session bean and have the session bean layer read and write the appropriate process variables from the ContextInstance and pass it back. Using reflection, the session bean and method name could thus be defined as ActionHandler parameters in the process definition.

      Could anyone comment on the cons of such setup? It feels like I am overlooking something obvious or reinventing something that?s already there.

      Thanks in advance for any help.

        • 1. Re: Passing ContextInstance as parameter to session bean ?
          kukeltje

          hmmmm... passing a context I would not do (to tightly coupled). The variable container is better or just passing a hashmap of objects where the objects are the variables (strongly java typed) and the keys are the variable names. Maybe in addition pass a processid/taskid/tokenid.

          for the rest, looks good. This is also what I would do (this is not in jBPM, yet (no work being done), care to put this on a wiki if it works? Maybe we can even start a 'project' in jBPM with these kinds of contributions

          • 2. Re: Passing ContextInstance as parameter to session bean ?
            preitsma

            Started to explore JBoss Seam and it looks like this provides the integration between Jbpm and EJB I am looking for.
            It allows to call any EJB using

            <action expression='#{ejb.method}'>
            and inject process variables through the BUSINESS_PROCESS scope.

            Let me know if I am wrong.

            It only seems that async and scheduled processing is not supported yet by Seam...