camunda / feel-scala

FEEL parser and interpreter written in Scala
https://camunda.github.io/feel-scala/
Apache License 2.0
124 stars 50 forks source link

Data Type Error using the plugin with CAMUNDA BPM DMN ENGINE #92

Closed riosje closed 4 years ago

riosje commented 4 years ago

Describe the bug

After deployed the plugin "feel-engine-plugin-1.10.1-complete.jar" https://blog.camunda.com/post/2017/03/feel-scala/

I'm still not able to evaluate rules with fee-scala

To Reproduce Steps to reproduce the behavior:

  1. Config bpm-platform.xml with plugin "org.camunda.feel.CamundaFeelEnginePlugin".
  2. Copy jar on libs folder
  3. Deploy any dmn with input data type feel-time or time

Evaluating the the dmn rule with this query:

{
  "variables" : {
    "vchVar1" : { "value" : "FDO", "type" : "string" },
    "vchHora" : { "value" : "10:00:00", "type" : "time" }
  }
}

I got this error:

{
    "type": "RestException",
    "message": "Unsupported value type 'time'"
}

Expected behavior

I expect to know how really to deploy the plugin and how to use it, is better if we could have a step by step example.

Environment How do you use the FEEL engine? As Camunda BPM process engine plugin? Together with Spring Boot? Something else? I have a docker container (from camunda docker hub), i rebuild the docker image and add the plugin in the libs folder and load the Config bpm-platform.xml with plugin

<process-engine>
    <plugins>
        <!-- other plugins -->    
        <plugin>
            <class>org.camunda.feel.CamundaFeelEnginePlugin</class>
        </plugin>
    </plugins> 
</process-engine>

Which version do you use? 7.12

riosje commented 4 years ago

and there is the documentation missing for BPM integration via plugin, (404 page not found) https://github.com/camunda/feel-scala/tree/master/feel-engine-plugin#usage

saig0 commented 4 years ago

@riosje, thank you for reporting.

It seems that this is not a problem with the FEEL engine itself. I can evaluate your DMN in the following JUnit test:

  @Test
  @Deployment(resources = {"Fondos.dmn"})
  public void testDmnTime() {

    final ZoneOffset zoneOffset = ZoneId.of("America/Bogota").getRules().getOffset(Instant.now());

    DmnDecisionTableResult result =
        rule.getDecisionService().evaluateDecisionTableByKey("FondosConfigHorarios")
            .variables(Variables.createVariables()
              .putValue("vchVar1", "FDO")
                .putValue("vchHora", LocalTime.parse("11:00:00").atOffset(zoneOffset))
            ).evaluate();

    System.out.println("> " + result.getSingleEntry());
  }

I think the variable type time is not supported by Camunda BPM 7.12.

"vchHora" : { "value" : "10:00:00", "type" : "time" }

I'm not sure how to pass it over the Camunda REST API.

saig0 commented 4 years ago

Regarding the documentation: the FEEL-Scala integration/project is currently adopted by the Camunda platform. As part of this, the integration modules, like the plugin, was moved into the platform repo. Please have a look at the previous version of the docs: https://github.com/camunda/feel-scala/tree/1.10.1/feel-engine-plugin