4 Replies Latest reply on Aug 11, 2014 12:49 PM by badtea

    How to call reusable subprocess without linking projects?

    badtea

      Hello,

      I followed this tutorial for calling reusable subprocesses.  In the tutorial, there are two projects: one for the main project and one for the reusable sub project.  The projects are "linked" by adding a dependency and making the projects share a knowledge base and knowledge session.  By doing this, I cannot deploy the sub project by itself.  I must deploy the main project, and it deploys both projects as a single deployment unit.

       

      I would like to deploy the projects separately.  In my ideal situation, I would like the main process to find the sub process at runtime, instead of at build time.  The main process would choose the latest version of the sub process that is deployed at that time.  If the sub process cannot be found at runtime, then the main process can throw an error.

       

      Is there any way to call sub processes at runtime like this?

       

      Thanks!

        • 1. Re: How to call reusable subprocess without linking projects?
          swiderski.maciej

          to be able to start subprocess via call activity then both parent and child process much be in the same knowledge base. This is why you need to deploy only the parent kjar that includes another kjar with subprocess definition.

           

          To be able to select any subprocess then you would need to do it with different constructs like send and receive tasks that remotely interact with the kie-wb to start a process and the wait for some signal to continue.

           

          HTH

          1 of 1 people found this helpful
          • 2. Re: How to call reusable subprocess without linking projects?
            badtea

            It sounds like I need to create some custom tasks or use some kind of messaging to start my subprocesses.  Now I am thinking I could create a custom task, like I read about in the docs (Chapter 21. Domain-specific Processes).  The custom task's job would be to initiate other business processes in the workbench.

             

            Alternatively, maybe I could create web services that invoke business processes in the workbench.  Then I could use a Service Task in the parent process to call the web service to start the child process.

             

            Am I understanding correctly?

             

            Thanks!

            • 3. Re: How to call reusable subprocess without linking projects?
              swiderski.maciej

              correct, use of Service task or custom task is perfectly valid approach.

               

              HTH

              • 4. Re: How to call reusable subprocess without linking projects?
                badtea

                I was able to get this to work in eclipse.  I created a custom task with a custom WorkItemHandler.  The task initiated the subprocess by using the existing REST API.  In particular, I used this call: /runtime/{deploymentId}/process/{processDefId}/start

                 

                I could not get this to work in the web console, because I cannot get custom work item handlers to work in the web console yet.  I will have to keep troubleshooting that problem.  But at least I have proven the concept of using a web service to call a subprocess.

                 

                Thanks for the help.