io.github.omarchenko4j.camunda.externaltask.ExternalTaskHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of camunda-spring-boot-starter-embedded-external-task-handler Show documentation
Show all versions of camunda-spring-boot-starter-embedded-external-task-handler Show documentation
Spring Boot Starter for embedded Camunda for fast handling of external tasks.
The newest version!
package io.github.omarchenko4j.camunda.externaltask;
import io.github.omarchenko4j.camunda.annotation.ExternalTaskTopicName;
import org.apache.commons.lang3.NotImplementedException;
import org.camunda.bpm.engine.externaltask.ExternalTask;
import org.springframework.core.annotation.AnnotationUtils;
import static java.util.Objects.nonNull;
import static org.apache.commons.lang3.StringUtils.isBlank;
/**
* An interface for a custom implementation of a handler that is called for an external task by topic name.
*
* @author Oleg Marchenko
*/
public interface ExternalTaskHandler {
/**
* Provides the topic name for the external task in Camunda.
*
* @return topic name for the external task
*/
default String topicName() {
ExternalTaskTopicName externalTaskTopicName =
AnnotationUtils.findAnnotation(getClass(), ExternalTaskTopicName.class);
if (nonNull(externalTaskTopicName)) {
String topicName = externalTaskTopicName.value();
if (isBlank(topicName)) {
throw new IllegalArgumentException("Topic name must not be empty");
}
return topicName;
}
else {
throw new NotImplementedException("Implement this method or provide an @ExternalTaskTopicName annotation");
}
}
/**
* Executes the logic for handling an external task from Camunda.
*
* @param externalTask external task for handling
*/
void handle(ExternalTask externalTask);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy