Class ExternalTaskInstanceResponder

java.lang.Object
io.taktx.client.ExternalTaskInstanceResponder

public class ExternalTaskInstanceResponder extends Object
A responder for handling external task instances, allowing to send success, error, escalation, or promise responses back to the process engine via Kafka.
  • Constructor Details

    • ExternalTaskInstanceResponder

      public ExternalTaskInstanceResponder(org.apache.kafka.clients.producer.KafkaProducer<UUID,io.taktx.dto.ContinueFlowElementTriggerDTO> responseEmitter, String topicName, UUID processInstanceId, List<Long> elementInstanceIdPath)
      Constructs an ExternalTaskInstanceResponder.
      Parameters:
      responseEmitter - The Kafka producer to send responses.
      topicName - The Kafka topic name to send responses to.
      processInstanceId - The ID of the process instance.
      elementInstanceIdPath - The path of element instance IDs.
  • Method Details

    • respondSuccess

      public void respondSuccess()
      Responds with a success message without any variables.
    • respondSuccess

      public void respondSuccess(Object variable)
      Responds with a success message including the provided variables.
      Parameters:
      variable - The variables to include in the response. It is directly serialized to a JSON map
    • respondSuccess

      public void respondSuccess(Map<String,com.fasterxml.jackson.databind.JsonNode> variablesMap)
      Responds with a success message including the provided variables map.
      Parameters:
      variablesMap - The map of variable names to their JSON values.
    • respondEscalation

      public void respondEscalation(String code, String message)
      Responds with an escalation message without any variables.
      Parameters:
      code - The escalation code.
      message - The escalation message.
    • respondEscalation

      public void respondEscalation(String code, String message, io.taktx.dto.VariablesDTO variables)
      Responds with an escalation message including the provided variables.
      Parameters:
      code - The escalation code.
      message - The escalation message.
      variables - The variables to include in the response.
    • respondError

      public void respondError(boolean allowRetry, String code, String message)
      Responds with an error message.
      Parameters:
      allowRetry - Whether to allow retrying the task.
      code - The error code.
      message - The error message.
    • respondError

      public void respondError(boolean allowRetry, String code, String message, io.taktx.dto.VariablesDTO variables)
      Responds with an error message.
      Parameters:
      allowRetry - Whether to allow retrying the task.
      code - The error code.
      message - The error message.
      variables - The variables to include in the response.
    • respondPromise

      public void respondPromise(Duration duration)
      Responds with a promise message indicating the task will be completed after the specified duration.
      Parameters:
      duration - The duration to wait before completing the task.