External Task Client Spring Boot Starter - Lock duration issues

Hi,

I have a Spring boot application with Camunda 7.15.
I have created an External Task Client Spring Boot starter according to External Task Client Spring Boot Starter | docs.camunda.org (and Spring Boot Starter for the External Task Client - Camunda).
It works fine but I think the Lock-duration behaves weird (or maybe I miss something).

In application.yml I have the following:

camunda.bpm.client:
  base-url: http://localhost:20000/engine-rest # the URL pointing to the Camunda Platform Runtime REST API
  lock-duration: 30000 # defines how many milliseconds the External Tasks are locked until they can be fetched again
  subscriptions:
    subA: # topic name of the External Service Task
      variable-names: [aVariable] # our business logic requires one variable
    subB:
      variable-names: []

Whatever value I put in the lock-duration, the polling seems to happen every 1 minute:

The documentation says that the lock-duration “is overridden by the lock duration configured on a topic subscription”. But I haven’t set any lock-duration for the subscription.
Is there maybe a default value that overrides my settings in application.yml?

Thx

I’ve also tried the following configuration:

camunda.bpm.client:
  base-url: http://localhost:20000/engine-rest # the URL pointing to the Camunda Platform Runtime REST API
  async-response-timeout: 1000 # defines the maximum waiting time for the response of fetched and locked External Tasks (long-polling).
#  lock-duration: 20000 # defines how many milliseconds the External Tasks are locked until they can be fetched again
  subscriptions:
    subA: # topic name of the External Service Task
      lock-duration: 10000 # defines how many milliseconds the External Tasks are locked until they can be fetched again. Overrides the lock duration configured on bootstrapping the Client
      variable-names: [aVariable] # our business logic requires one variable
    subB:
      lock-duration: 10000 # defines how many milliseconds the External Tasks are locked until they can be fetched again. Overrides the lock duration configured on bootstrapping the Client
      variable-names: [] # our business logic doesn't require any variables, so don't fetch them

but still no difference in fetching/polling behavior:

Actually, it’s interesting that the Fetch works more frequently when I start the application and then it goes to the 1-minute frequency.

Any ideas?

Hi @kontrag,

the lock time has nothing to with the polling interval of the client.

A good way to reduce the network traffic is to use long polling: External Tasks | docs.camunda.org

Hope this helps, Ingo

Hi @Ingo_Richtsmeier,

Yes, kinda suspected that but in the spring boot started how can I configure the polling interval?
Is the async-response-timeout property intended for that reason? As you can see, I set it to 1000, but I don’t see any difference in the logs. Shouldn’t I?

My problem is that in my model I have a User Task and afterwards an External service Task, once the User Task is completed, I notice some delay until the External Task is activated. So I want to experiment with the polling interval.

Thanks

Hi @kontrag,

the async-response-timeout could be set to a value of 30000 which is 30 seconds or maybe a minute.

By default the external task client also doubles the backoff interval up a minute when no task is fetched. This may cause long delays between task create and task work, as well. You can limit the max-backoff to a smaller value that would be acceptable like 4 or 8 seconds.

The optimal setting depends on the number of external tasks you expect over time.

Hope this helps, Ingo

Thanks @Ingo_Richtsmeier .
Is there a property for the backoff interval or should I just set the async-response-timeout into 4-8 seconds?

Hi @kontrag,

you can either set disable-backoff-strategy to true (External Task Client Spring Boot Starter | docs.camunda.org) or create a new ExponentialBackoffStrategy like:

builder.backoffStrategy(new ExponentialBackoffStrategy(500, 2, 8000));

Hope this helps, Ingo

1 Like