io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans Maven / Gradle / Ivy
package io.camunda.zeebe.spring.client.jobhandling;
import io.camunda.zeebe.client.api.command.CompleteJobCommandStep1;
import io.camunda.zeebe.client.api.command.FinalCommandStep;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.worker.JobClient;
import io.camunda.zeebe.client.api.worker.JobHandler;
import io.camunda.zeebe.client.impl.Loggers;
import io.camunda.zeebe.spring.client.annotation.ZeebeCustomHeaders;
import io.camunda.zeebe.spring.client.annotation.ZeebeVariable;
import io.camunda.zeebe.spring.client.annotation.ZeebeVariablesAsType;
import io.camunda.zeebe.spring.client.bean.ParameterInfo;
import io.camunda.zeebe.spring.client.bean.value.ZeebeWorkerValue;
import io.camunda.zeebe.spring.client.exception.ZeebeBpmnError;
import org.slf4j.Logger;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Zeebe JobHandler that invokes a Spring bean
*/
public class JobHandlerInvokingSpringBeans implements JobHandler {
private static final Logger LOG = Loggers.JOB_WORKER_LOGGER;
private ZeebeWorkerValue workerValue;
private DefaultCommandExceptionHandlingStrategy commandExceptionHandlingStrategy;
public JobHandlerInvokingSpringBeans(ZeebeWorkerValue workerValue, DefaultCommandExceptionHandlingStrategy commandExceptionHandlingStrategy) {
this.workerValue = workerValue;
this.commandExceptionHandlingStrategy = commandExceptionHandlingStrategy;
}
@Override
public void handle(JobClient jobClient, ActivatedJob job) throws Exception {
// TODO: Figuring out parameters and assignments could probably also done only once in the beginning to save some computing time on each invocation
List