Class ExternalTaskInstanceResponder
java.lang.Object
io.taktx.client.ExternalTaskInstanceResponder
A responder for handling external task instances, allowing to send success, error, escalation, or
promise responses back to the process engine via Kafka.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidrespondError(boolean allowRetry, String code, String message) Responds with an error message.voidrespondError(boolean allowRetry, String code, String message, io.taktx.dto.VariablesDTO variables) Responds with an error message.voidrespondEscalation(String code, String message) Responds with an escalation message without any variables.voidrespondEscalation(String code, String message, io.taktx.dto.VariablesDTO variables) Responds with an escalation message including the provided variables.voidrespondPromise(Duration duration) Responds with a promise message indicating the task will be completed after the specified duration.voidResponds with a success message without any variables.voidrespondSuccess(Object variable) Responds with a success message including the provided variables.voidrespondSuccess(Map<String, com.fasterxml.jackson.databind.JsonNode> variablesMap) Responds with a success message including the provided variables map.
-
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
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
-
respondEscalation
-
respondEscalation
-
respondError
-
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
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.
-