External Tasks Priority Not Working

Hi Tobias,

Is there a “topics” API or are you just thinking of a new feature? But the second example, I didn’t know you could fetchAndLock before deciding which topics to grab. That’s exactly what I need to do. For our implementation, we limit the number to lock based on the number of CPUs available and we spawn off threads for each locked task. We will have to rework our code to do it like your example, but sounds very promising.

You can close that JIRA ticket that I opened with the priority bug in the Java API. Sorry for hunt, but this does help on how to use the fetchAndLock API better so it’s very useful for me and others.

Thanks again!

Jim

I believe his example is just doing a multi step builder. It’s only executing at the end. It’s not obvious from the code but can see he is only running the execution of the builder on the last line

Hi Jim,

the “topics” call is not in the API, this is just what I imagined the requested feature you were thinking of could look like, sorry for the missing clarification on this.

As for the example code, the fetchAndLock(...) method in the ExternalTaskService is always returning a query builder on which the execute() needs to be called when the configuration is done, as @StephenOTT correctly stated.

Glad it helps you.

Best,
Tobias

@jamesfwood you might be able to make a modificaiton to the engine and then build a new endpoint.

Looking at the code:

The query builder for tasks uses:

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.10/org/camunda/bpm/engine/externaltask/ExternalTaskQueryTopicBuilder.html#processInstanceVariableEquals-java.util.Map-

which is backed by:

which is backed by:

which just calls the line below:

Notice the QueryOperator.EQUALS

which is backed by:

and

which gives you the https://github.com/camunda/camunda-bpm-platform/blob/6fd62f5c7492b98f0187f0392dc1ea2a94342cda/engine/src/main/java/org/camunda/bpm/engine/impl/QueryOperator.java#L32 LIKE operator.

So you could add a new method to the ExternalTask builder that adds a LIKE capability.

From the looks of it, this should give you the ability to filter for your variables: so you can have a more generic Topic name, and then have a variable that you can use as the unique mapping.