1 Reply Latest reply on Dec 21, 2013 10:36 AM by Jiri Svitak

    jbpm6 configuration by exception

    wieslaw pilarczyk Newbie

      I consider now CDI as a natural extension to Java making programming life more comfortable and I wouldn't like to live without it even when creating standalone applications. So I wonder, if I could do something like this:

       

      public class KieCdi

      {

          @Inject

          @KReleaseId(groupId = "my", artifactId = "jbpmcdi", version = "1")

          KieSession kieSession;

        

          public static void main( String[] args )

          {

              new Weld()

                  .initialize()

                  .instance()

                  .select(KieCdi.class)

                  .get()

                  .run();

          }

        

          void run()

          {

              kieSession.startProcess("myproc");

          }

      }

       

      Kmodule.xml contains only the information about the process definition:

       

      <kbase name="kbase" includes="proc.bpmn2"/>

       

      Without any additional information I should be able to get some default session, which uses some default services. Later I could adjust the environment to my specific needs. I can provide all the needed Maven dependencies, if I knew what could they be.

      It fails now complaining about missing kproject.xml (message coming from KieCDIExtension), what is this file? And is this approach feasible at all?

       

      I tried also another approach:

       

      public class App

      {

          @Inject

          @PerProcessInstance

          RuntimeManager manager;

        

          public static void main( String[] args )

          {

              new Weld()

                  .initialize()

                  .instance()

                  .select(App.class)

                  .get()

                  .run();

          }

        

          void run()

          {

              manager.getRuntimeEngine(ProcessInstanceIdContext.get())

                  .getKieSession()

                  .startProcess("proc");

          }

      }

       

      This time I came up to startProcess() (I provided missing dependencies using CDI producers) but now I don't know how to provide declaratively kbase. It can be done programmatically, but then I am deprived from CDI advantages.

       

      Wieslaw