Execution doesn't get out from External Task,

Hi Everyone,
When i am executing my Process and when the execution passes through one of my external Task, the process execution gets stuck there, there is no error, no warning, nothing.
The execution doesn’t flow to the next task.

I checked if there is something wrong in my External Task, by adding end listeners to my external task, and tried printing logs there, I was able to able to print logs.

The external Task Code:

ExternalTaskClient client = ExternalTaskClient.create().baseUrl("http://" + PROCESS_ENGINE_URL + "/rest")
                .workerId("eventWorker").build();
              TopicSubscriptionBuilder testSubscriptionBuilder = client.subscribe("eventConfiguration")
                 .handler((externalTask, externalTaskService) -> {
                    logger.info("External Service(Event Configuration)  Started " + new Date());
                   externalTaskService.complete(externalTask)

                }); client.start();
    testSubscriptionBuilder.open();

@satyaram413 you can refer this example:

@Slf4j
@Component
public class ExternalTaskServiceWorker {

  @Autowired
  private Gson gsonParser;

  @Autowired
  private ExternalWorkerConfiguration externalWorkerConfiguration;

  @EventListener(ApplicationReadyEvent.class)
  public void handleExternalTasks() {
    log.info("Initialzing the ExternalTaskServiceWorker with configuration:{}", externalWorkerConfiguration);

    ExternalTaskClient externalTaskClient = ExternalTaskClient.create()
        .baseUrl(externalWorkerConfiguration.getBaseUrl())
        .addInterceptor(
            requestContext -> requestContext.addHeader("Authorization", externalWorkerConfiguration.getAuthorization()))
        .asyncResponseTimeout(1000).maxTasks(2).workerId(externalWorkerConfiguration.getWorkerId()).build();

    TopicSubscription topicSubscription = externalTaskClient.subscribe(externalWorkerConfiguration.getTopicName())
        .handler((externalTask, externalTaskService) -> {

          String compensatedActivity = externalTask.getVariable("compensatedActivity");
          if (StringUtils.hasText(compensatedActivity)) {
            compensatedActivity = compensatedActivity + "," + externalTask.getActivityId();
          } else {
            compensatedActivity = externalTask.getActivityId();
          }

          TenantActivationStatus tenantActivationStatus = TenantActivationStatus.builder()
              .activationStatus(ACTIVATION_STATUS.DE_ACTIVATED.getActivationStatus())
              .compensatedActivites(Arrays.stream(compensatedActivity.split(",")).collect(Collectors.toList()))
              .servicesList(Arrays.asList("Inventory service", "Order Management service", "Payments Service"))
              .tenantId(externalTask.getVariable("tenant")).build();

          JsonValue activationStatusValue = ClientValues.jsonValue(gsonParser.toJson(tenantActivationStatus));

          Map<String, Object> variables = new HashMap<>();
          variables.put("tenantActivationStatus", activationStatusValue);
          variables.put("compensatedActivity", compensatedActivity);

          externalTaskService.complete(externalTask, variables);

          // externalTaskService.extendLock(externalTask, newDuration);
          // externalTaskService.handleBpmnError(externalTask, errorCode);
          // externalTaskService.handleFailure(externalTask, errorMessage, errorDetails, retries,
          // retryTimeout);

          log.info("ExternalTask {} with businessKey {} completed!!!", externalTask.getId(),
              externalTask.getBusinessKey());

        }).lockDuration(30000).open();

    log.info("ExternalTaskServiceWorker has subscribed to the topic {} sucessfully", topicSubscription.getTopicName());
  }

}

Did you check the worker logs?

Hi @aravindhrs,
The above code was working in a standalone Camunda Tomcat Deployment, but we moved to microservices recently, since then we are facing this issue. I will check the solution you mentioned.

Yes @aravindhrs.
I have kept logs after the external completion, and they work fine.

Before, did you deploy and run the external workers in the tomcat/wildfly?

No, I used to deploy my services war in tomcat and run external worker as a independent jar, this jar can make connection with my Process ENgine, so it would listen to the topics, that i have mentioned in bpmn task.

So if I understood correctly, the process application deployed war was now changed to microservice architecture right?

Yes @aravindhrs, Exactly

@satyaram413 did you enabled “jobExecutorActivate=true” ? Have you tried the above mentioned external task worker?

@aravindhrs, where do i enable jobExecutorActivate=true, as i am not use tomcat to do that, how can i enable this option in microservices.
2. Having dependency issues @aravindhrs, working on it, will post the output.

Thanks much

In application.yml

camunda:
  bpm:
    enabled: true
    
    job-execution:
      enabled: true
1 Like

Also, did you enabled deploymentAware=true when process application is deployed as war?

Are using shared database?

@aravindhrs, previously when we were using standalone approach to deploy wars, we have disabled jobExecutorDeploymentAware, but that didn’t create any issues. The reason why we had to disable it, because we were having few issues while using timer event.

yes, it should be disabled in your case.

Would this configuration do,
camunda:
bpm:
enabled: true
job-execution:
enabled: true
deployment-aware:
enabled: false

Yeah. Make sure the indentation.

1 Like

Sorry for the delayed response @arvindhrs,
The solution you suggested worked.

Thanks much Arvindh.