Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-14685

Fetching external tasks filtered by LONG process variables does not work with small values

    XMLWordPrintable

Details

    • Bug Report
    • Resolution: Unresolved
    • L3 - Default
    • None
    • None
    • engine
    • None

    Description

      Environment (Required on creation): 

      • All distros, all databases

      Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

      • Using the Fetch&Lock REST API, I cannot lock tasks that have a LONG-typed variable that I want to filter by if the number value in the REST request is small enough to be interpreted as an INTEGER. I receive an empty result although the external task should be found.

      POST request

      {
          "topics": [
              {
                  "topicName": "myExternalTask",
                  "lockDuration": 30000,
                  "processVariables": {
                      "offerId": 999
                  }
              }
          ],
          "workerId": "offerWorkerId",
          "maxTasks": 1
      }
      

      Steps to reproduce (Required on creation):

      1. Instantiate an External Task with a LONG-typed variable with a small value like 999.
      2. Try to fetch the task via REST API, providing a processVariables filter for the variable and the value 999

      Observed Behavior (Required on creation):

      • The External Task is not fetched and locked
      • The query filters by type INTEGER
        SELECT DISTINCT RES.*
        FROM
          (SELECT RES.*,
                  PI.BUSINESS_KEY_,
                  PD.VERSION_TAG_
           FROM ACT_RU_EXT_TASK RES
           LEFT JOIN ACT_RU_EXECUTION PI ON RES.PROC_INST_ID_ = PI.ID_
           INNER JOIN ACT_RE_PROCDEF PD ON RES.PROC_DEF_ID_ = PD.ID_
           WHERE (RES.LOCK_EXP_TIME_ IS NULL
                  OR RES.LOCK_EXP_TIME_ <= '2022-05-25 08:52:56.026'(Timestamp))
             AND (RES.SUSPENSION_STATE_ IS NULL
                  OR RES.SUSPENSION_STATE_ = 1)
             AND (RES.RETRIES_ IS NULL
                  OR RES.RETRIES_ > 0)
             AND (RES.TOPIC_NAME_ = 'test'
                  AND RES.PROC_INST_ID_ in
                    (SELECT VAR.EXECUTION_ID_
                     FROM ACT_RU_VARIABLE VAR
                     WHERE (VAR.NAME_ = 'testId'
                            AND ((VAR.TYPE_ IS NOT NULL
                                  AND VAR.TYPE_ = 'integer'
                                  AND VAR.LONG_ IS NOT NULL
                                  AND VAR.LONG_ = 300))) )) ) RES
        

      Expected behavior (Required on creation):

      • The External Task is fetched and locked

      Root Cause (Required on prioritization):

      1. The REST API transforms the given value into the smallest possible Java data type.
      2. A number value like `300` is transformed into an `Integer`.
      3. The query against our database to fetch the external task uses an `Integer` for filtering by the process variable.
      4. There is no variable with the given name of type `Integer`.
      5. No external task is found.

      Solution Ideas (Optional):

      1. Ignore the specific type provided by the REST API conversion
      2. Provide all potential types in the query by duplicating the process variable filter for all variables
      3. Allow filtering by object values in the fetch and lock REST API

      Hints (optional):

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

              Unassigned Unassigned
              tobias.metzke Tobias Metzke-Bernstein
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Salesforce