3 Replies Latest reply on Jan 15, 2008 5:58 PM by JeanDenis Bertron

    jBPM in EJB environment

    Thorsten Kraus Newbie

      Hello,

      I want to ust jBPM for controlling the state and the state transitions from a particular business object.
      These business objects are represented by entity beans and my client application accesses the server via a stateless session bean. I am a bit confused about the best way to integrate jBPM in my application because I currently ask myself where I have to start the jBPM engine. I can't start the jBPM engine in a stateless session bean because the bean woild forget its state when the request is over.
      I think I need a way to integrate jBPM in the way that it lives the whole time over many client requests which are made through my session bean.

      Can someone of you help me with this problem?

      Regards,
      TMK

        • 2. Re: jBPM in EJB environment
          Vitaly Xaoc Newbie

           

          I think I need a way to integrate jBPM in the way that it lives the whole time over many client requests which are made through my session bean.

          jbpm persists all data which are connected with process in datasource (database). So I reckon after stateless session bean destruction your process will be saved.
          Please, seniors correct me if I am not right! Because I am yet a junior in jbpm.

          • 3. Re: jBPM in EJB environment
            JeanDenis Bertron Newbie

            Haha,
            Very good question.
            OK, I assume you want the database, hibernate cfg and jbpm cfg hidden from your users/applets, and you want the BPM to actually run on the J2EE server.
            It's possible.
            The Service Bean implementation actually relies on a couple of service beans.
            It's been a while but you basically need to look them up,

            Context initial = new InitialContext();
            Object obj = initial.lookup(remoteCommandServiceJndiName);
            RemoteCommandServiceHome remoteCommandServiceHome = (RemoteCommandServiceHome) PortableRemoteObject.narrow(obj,RemoteCommandServiceHome.class );
            remoteCommandService = remoteCommandServiceHome.create();

            and then you can use the service reference by sending it commands to execute:

            result = remoteCommandService.execute(new GetProcessInstanceCommand(processInstanceId));

            It's a really good design, but don't get your hopes up, it's not fully functional.
            There are only about 6 command objects in the library, barely enough to get a listing of processes and their definitions. That works well. You can even signal transitions.

            I'm patiently waiting to see if someone is going to contribute more commands to check permissions and set actors, get tasks etc...
            It might be in there already, but I doubt it. And since the documentation, well , you're on your own.
            Please post what you find here though. I'll have to tackle that myself when I'm done with the POJO implementation.

            J.D.