Camunda.Worker external task services not completing

Hello everyone and happy new year!

I have a question regarding Camunda service tasks in association with the Camunda.Worker .NET library.

In my deployed process I have two service tasks which I have configured as external type and a specific topic name. In my .NET application I have created two different Handlers to execute these tasks. I have to admit that I have some trouble understanding the exact way this concept is implemented.

Now, my problem is that in some occasions when the flow gets to the service task it is executed right away, some other times takes longer and finally some times it does not complete and by checking my code it does not seem to enter the handler.

My thought is that in cases that multiple instances of my API are running, it may cause issues with the lock of the service task. Is this a possible case?

I am attaching an example of my Handler to better demonstrate my case.

[HandlerTopics(“Protocol”)]

public class CreateOrderProtocolHandler : IExternalTaskHandler
{
private readonly ILogger _logger;
private readonly IFileManager _file;
private readonly IOrderSubmissionService _orderSubmissionService;
private readonly ICamundaProvider _camundaProvider;

public CreateOrderProtocolHandler(ILogger<CreateOrderProtocolHandler> logger, IFileManager file,
    ICamundaProvider camundaProvider,
    IOrderSubmissionService orderSubmissionService)
{
    _logger = logger;
    _file = file;
    _orderSubmissionService = orderSubmissionService;
    _camundaProvider = camundaProvider;
            }

public async Task<IExecutionResult> HandleAsync(ExternalTask externalTask, CancellationToken cancellationToken)
{
    try
    {
        string businessKey = externalTask.BusinessKey;

        OrderSubmission orderSubmission = await _orderSubmissionService
            .GetOrderSubmissionByBusinessKey(businessKey, cancellationToken);

        if (orderSubmission == null)
        {
            return null;
        }

        _logger.LogWarning($"businessKey: {businessKey}");

        GeneralResponse<FileDto> response = await _file.GeneratePdf(businessKey, "generated_order", cancellationToken);

        var updateResult = await _orderSubmissionService.UpdateOrderSubmissionTaskName(orderSubmission, "Ανάθεση");

        return await _camundaProvider.CreateOrderProtocol(response.Result.FileName);

    }
    catch (Exception ex)
    {
        _logger.LogError($"error occurred!! error message: {ex.Message}");

        return new BpmnErrorResult("CreateOrderProtocolFailure", "Error occurred while generating order.");
    }
}

}

public async Task CreateOrderProtocol(string fileName)
{
CompleteResult result = new CompleteResult();

result.Variables = new Dictionary<string, VariableBase>
{
    ["generatedOrder"] = new StringVariable(fileName)
};

return result;

}

Thank you for any help provided!