2 Replies Latest reply on Oct 21, 2014 5:00 AM by dsouzapreethi

    Execution of bpmn processes from java code.

    dsouzapreethi

      Is it possible to execute bpmn processes deployed in s-ramp repository from server side code in FSW?

      If yes may i know the steps to perform?

      The requirement is to trigger bpmn processes using schedular periodically from server.

       

      Thanks in advance

      -Preethi

        • 1. Re: Execution of bpmn processes from java code.
          kcbabo

          You mentioned that the processes are deployed in S-RAMP. Are these for design-time governance workflows or are they used for service orchestration inside a FSW runtime?

          • 2. Re: Execution of bpmn processes from java code.
            dsouzapreethi

            Hi Keith,

            Thanks for ur reply.

            I am able to resolve this problem with SrampAtomApiClient API.

             

            Here is my code snippet:

            private static final String endpoint = "http://localhost:8080/s-ramp-server";

                private static final String user = "test";

                private static final String password = "test@123";

                private static String SRAMP_KIE_JAR_QUERY_FORMAT="/s-ramp/ext/KieJarArchive[" //$NON-NLS-1$

              + "@maven.groupId='%s' and " //$NON-NLS-1$

              + "@maven.artifactId = '%s' and " //$NON-NLS-1$

              + "@maven.version = '%s']"; //$NON-NLS-1$

             

              SrampAtomApiClient client = new SrampAtomApiClient(endpoint, username, password, true);

             

             

              String srampQuery = String.format(SRAMP_KIE_JAR_QUERY_FORMAT, "com.sramp", "srampproj", "1.0");

              QueryResultSet results = client.query(srampQuery);

             

              ArtifactSummary artifactSummery = results.get(0);

              InputStream is = client.getArtifactContent(artifactSummery);

              KieServices ks = KieServices.Factory.get();

                  KieRepository repo = ks.getRepository();

                  KieModule kModule = repo.addKieModule(ks.getResources().newInputStreamResource(is));

                  KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId());

                  KieSession session1=kContainer.newKieSession();

                  session1.startProcess("srampproj.samplebpmn");