1 Reply Latest reply on Jul 24, 2014 1:34 PM by jmiguel77

    execute rules using the RemoteRestRuntimeFactory

    jmiguel77

      hi

       

      i am trying to execute rules deployed in a remote server using the RemoteRestRuntimeFactory of the kie services client. As a detail, i should say that the server where the bpms is running and the server where the application is running are different machines.

       

      This is what i am doing right now (in a @Stateless EJB ) in the client application:

       

      URL baseUrl = new URL("http://server:8080/business-central/");

      RemoteRestRuntimeFactory factory = new RemoteRestRuntimeFactory(DEPLOYMENT_ID, baseUrl, USER, PASSWORD);

      RuntimeEngine kieRuntimeEngine = factory.newRuntimeEngine();

      KieSession kieSession = kieRuntimeEngine.getKieSession();

       

      CondicionesCta condiciones = new CondicionesCta();

      condiciones.setIdGrupoCta(4);

      condiciones.setAgenciaInternacional(Boolean.TRUE);

      kieSession.insert(condiciones);

      int rulesApplied = kieSession.fireAllRules();

       

      In the bpms server, i have a project with a rule that looks like this:

       

      package com.ec.mutualista.aperturacta;

      import java.lang.Number;

      rule "CondContrInternac"

      dialect "mvel"

      when

        condiciones : CondicionesCta( agenciaInternacional == true , idGrupoCta == 4 )

      then

        condiciones.setFirmante( true );

        condiciones.setSeguro( true );

        condiciones.setTarjeta( true );

        condiciones.setNumserie( false );

        condiciones.setTipoTarjeta( "DEBCHIP" );

      end

       

      When i execute the ejb i am getting no errors, but the value of the rulesApplied variable is always 0, so, no rules are applied

      Is this even possible ? is there any other way this can be achieved ?

       

      thanks