I am using Camunda.Worker in my .NET application to create some topic handlers that will complete the service tasks in my Camunda process. Recently (not always) it takes a long time to handle these tasks. I see the logs of my backend and I see it sends requests (fetchAndLock) for some time before it actually executes it. It may take like 5 minutes which is obviously not viable. I don't know if I need further configuration of my handlers. If anyone can provide some additional information I would appreciate it.
{"version":"7.19.0"}
Following, I am adding an example of my handler.
Thank you in advance!
[![\[HandlerTopics("CreateOrder")\]
public class CreateOrderHandler : IExternalTaskHandler {
public CreateOrderHandler(ILogger<CreateOrderHandler> 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
.GetCOrderSubmissionByBusinessKey(businessKey, cancellationToken);
if (orderSubmission == null)
{
return null;
}
_logger.LogWarning($"businessKey: {businessKey}");
GeneralResponse<FileDto> response = await _file.GeneratePdf(businessKey, "created_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("CreateOrderFailure", "Error occurred while creatingorder.");
}
} }
