diff --git a/contribs/src/main/java/com/netflix/conductor/contribs/metrics/LoggingMetricsConfiguration.java b/contribs/src/main/java/com/netflix/conductor/contribs/metrics/LoggingMetricsConfiguration.java index 5925ed6b67..8f6987c29d 100644 --- a/contribs/src/main/java/com/netflix/conductor/contribs/metrics/LoggingMetricsConfiguration.java +++ b/contribs/src/main/java/com/netflix/conductor/contribs/metrics/LoggingMetricsConfiguration.java @@ -40,7 +40,7 @@ public class LoggingMetricsConfiguration { // This way one can cleanly separate the metrics stream from rest of the logs private static final Logger METRICS_LOGGER = LoggerFactory.getLogger("ConductorMetrics"); - @Value("${metrics.logger.reportPeriodSeconds:30}") + @Value("${conductor.metrics.logger.reportPeriodSeconds:30}") private long metricsReportInterval; @Bean diff --git a/core/src/main/java/com/netflix/conductor/core/config/ConductorCoreConfiguration.java b/core/src/main/java/com/netflix/conductor/core/config/ConductorCoreConfiguration.java index c17cfe585d..82cbf568ca 100644 --- a/core/src/main/java/com/netflix/conductor/core/config/ConductorCoreConfiguration.java +++ b/core/src/main/java/com/netflix/conductor/core/config/ConductorCoreConfiguration.java @@ -12,25 +12,31 @@ */ package com.netflix.conductor.core.config; +import static com.netflix.conductor.core.events.EventQueues.EVENT_QUEUE_PROVIDERS_QUALIFIER; + import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.netflix.conductor.common.utils.ExternalPayloadStorage; +import com.netflix.conductor.core.events.EventQueueProvider; +import com.netflix.conductor.core.execution.mapper.TaskMapper; import com.netflix.conductor.core.listener.WorkflowStatusListener; import com.netflix.conductor.core.listener.WorkflowStatusListenerStub; import com.netflix.conductor.core.storage.DummyPayloadStorage; import com.netflix.conductor.core.sync.Lock; import com.netflix.conductor.core.sync.NoopLock; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; - -@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") -@Configuration +@Configuration(proxyBeanMethods = false) public class ConductorCoreConfiguration { private static final Logger LOGGER = LoggerFactory.getLogger(ConductorCoreConfiguration.class); @@ -62,4 +68,18 @@ public ExecutorService executorService(ConductorProperties conductorProperties) .build(); return Executors.newFixedThreadPool(conductorProperties.getExecutorServiceMaxThreads(), threadFactory); } + + @Bean + @Qualifier("taskProcessorsMap") + public Map getTaskMappers(List taskMappers) { + return taskMappers.stream() + .collect(Collectors.toMap(t -> t.getTaskType().name(), t -> t)); + } + + @Bean + @Qualifier(EVENT_QUEUE_PROVIDERS_QUALIFIER) + public Map getEventQueueProviders(List eventQueueProviders) { + return eventQueueProviders.stream() + .collect(Collectors.toMap(EventQueueProvider::getQueueType, e -> e)); + } } diff --git a/core/src/main/java/com/netflix/conductor/core/config/EventConfiguration.java b/core/src/main/java/com/netflix/conductor/core/config/EventConfiguration.java index cb67063379..c8a14381ce 100644 --- a/core/src/main/java/com/netflix/conductor/core/config/EventConfiguration.java +++ b/core/src/main/java/com/netflix/conductor/core/config/EventConfiguration.java @@ -36,7 +36,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; -@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Configuration(proxyBeanMethods = false) public class EventConfiguration { diff --git a/core/src/main/java/com/netflix/conductor/core/config/EventQueueConfiguration.java b/core/src/main/java/com/netflix/conductor/core/config/EventQueueConfiguration.java deleted file mode 100644 index 3a945fe86e..0000000000 --- a/core/src/main/java/com/netflix/conductor/core/config/EventQueueConfiguration.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2020 Netflix, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.netflix.conductor.core.config; - -import com.netflix.conductor.core.events.EventQueueProvider; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.util.Map; - -import static com.netflix.conductor.core.events.EventQueues.EVENT_QUEUE_PROVIDERS_QUALIFIER; - -@Configuration -public class EventQueueConfiguration { - - @Bean - public EventQueueProviders eventQueueProviders() { - return new EventQueueProviders(); - } - - @Bean - @Qualifier(EVENT_QUEUE_PROVIDERS_QUALIFIER) - public Map getEventQueueProviders(EventQueueProviders eventQueueProviders) { - return eventQueueProviders.getEventQueueProviders(); - } -} diff --git a/core/src/main/java/com/netflix/conductor/core/config/EventQueueProviders.java b/core/src/main/java/com/netflix/conductor/core/config/EventQueueProviders.java deleted file mode 100644 index 176986bbf6..0000000000 --- a/core/src/main/java/com/netflix/conductor/core/config/EventQueueProviders.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2020 Netflix, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.netflix.conductor.core.config; - -import com.netflix.conductor.core.events.EventQueueProvider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanPostProcessor; - -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; - -public class EventQueueProviders implements BeanPostProcessor { - - private static final Logger LOGGER = LoggerFactory.getLogger(EventQueueProviders.class); - private final Map eventQueueProviders = new HashMap<>(); - - @SuppressWarnings("NullableProblems") - @Override - public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { - if (bean instanceof EventQueueProvider) { - final EventQueueProvider eventQueueProvider = (EventQueueProvider) bean; - Optional.ofNullable(eventQueueProvider.getQueueType()) - .ifPresent(queueType -> { - LOGGER.info("Adding Event Queue Provider bean: {} for queueType: {} to eventQueueProviders", - beanName, queueType); - eventQueueProviders.put(queueType, eventQueueProvider); - }); - } - return bean; - } - - public Map getEventQueueProviders() { - return eventQueueProviders; - } -} diff --git a/core/src/main/java/com/netflix/conductor/core/config/TaskMapperConfiguration.java b/core/src/main/java/com/netflix/conductor/core/config/TaskMapperConfiguration.java deleted file mode 100644 index 5e77e31ccf..0000000000 --- a/core/src/main/java/com/netflix/conductor/core/config/TaskMapperConfiguration.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2020 Netflix, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.netflix.conductor.core.config; - -import com.netflix.conductor.core.execution.mapper.TaskMapper; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.util.Map; - -@Configuration -public class TaskMapperConfiguration { - - @Bean - public TaskMappers taskMappers() { - return new TaskMappers(); - } - - @Bean - @Qualifier("taskProcessorsMap") - public Map getTaskMappers(TaskMappers taskMappers) { - return taskMappers.getTaskMappers(); - } -} diff --git a/core/src/main/java/com/netflix/conductor/core/config/TaskMappers.java b/core/src/main/java/com/netflix/conductor/core/config/TaskMappers.java deleted file mode 100644 index 835de2a5f1..0000000000 --- a/core/src/main/java/com/netflix/conductor/core/config/TaskMappers.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2020 Netflix, Inc. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.netflix.conductor.core.config; - -import com.netflix.conductor.core.execution.mapper.TaskMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanPostProcessor; - -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; - -public class TaskMappers implements BeanPostProcessor { - - private static final Logger LOGGER = LoggerFactory.getLogger(TaskMappers.class); - private final Map taskMappers = new HashMap<>(); - - @SuppressWarnings("NullableProblems") - @Override - public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { - if (bean instanceof TaskMapper) { - final TaskMapper taskMapper = (TaskMapper) bean; - Optional.ofNullable(taskMapper.getTaskType()) - .ifPresent(taskType -> { - LOGGER.info("Adding Task Mapper bean: {} for taskType: {} to taskMappers", beanName, taskType); - taskMappers.put(taskType, taskMapper); - }); - } - return bean; - } - - public Map getTaskMappers() { - return taskMappers; - } -} diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/DecisionTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/DecisionTaskMapper.java index 80ce742c5e..61faed36cd 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/DecisionTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/DecisionTaskMapper.java @@ -21,16 +21,15 @@ import com.netflix.conductor.core.events.ScriptEvaluator; import com.netflix.conductor.core.exception.TerminateWorkflowException; import com.netflix.conductor.core.execution.SystemTaskType; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.script.ScriptException; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; +import javax.script.ScriptException; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; /** * An implementation of {@link TaskMapper} to map a {@link WorkflowTask} of type {@link TaskType#DECISION} to a List @@ -43,8 +42,8 @@ public class DecisionTaskMapper implements TaskMapper { private static final Logger LOGGER = LoggerFactory.getLogger(DecisionTaskMapper.class); @Override - public String getTaskType() { - return TaskType.DECISION.name(); + public TaskType getTaskType() { + return TaskType.DECISION; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/DoWhileTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/DoWhileTaskMapper.java index a372cdbef7..014707cf40 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/DoWhileTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/DoWhileTaskMapper.java @@ -21,19 +21,20 @@ import com.netflix.conductor.common.utils.TaskUtils; import com.netflix.conductor.core.execution.SystemTaskType; import com.netflix.conductor.dao.MetadataDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /** * An implementation of {@link TaskMapper} to map a {@link WorkflowTask} of type {@link TaskType#DO_WHILE} to a {@link * Task} of type {@link SystemTaskType#DO_WHILE} */ +@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Component public class DoWhileTaskMapper implements TaskMapper { @@ -41,13 +42,14 @@ public class DoWhileTaskMapper implements TaskMapper { private final MetadataDAO metadataDAO; + @Autowired public DoWhileTaskMapper(MetadataDAO metadataDAO) { this.metadataDAO = metadataDAO; } @Override - public String getTaskType() { - return TaskType.DO_WHILE.name(); + public TaskType getTaskType() { + return TaskType.DO_WHILE; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/DynamicTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/DynamicTaskMapper.java index 9038c79632..e63bbebf12 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/DynamicTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/DynamicTaskMapper.java @@ -22,19 +22,20 @@ import com.netflix.conductor.core.exception.TerminateWorkflowException; import com.netflix.conductor.core.utils.ParametersUtils; import com.netflix.conductor.dao.MetadataDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /** * An implementation of {@link TaskMapper} to map a {@link WorkflowTask} of type {@link TaskType#DYNAMIC} to a {@link * Task} based on definition derived from the dynamic task name defined in {@link WorkflowTask#getInputParameters()} */ +@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Component public class DynamicTaskMapper implements TaskMapper { @@ -43,14 +44,15 @@ public class DynamicTaskMapper implements TaskMapper { private final ParametersUtils parametersUtils; private final MetadataDAO metadataDAO; + @Autowired public DynamicTaskMapper(ParametersUtils parametersUtils, MetadataDAO metadataDAO) { this.parametersUtils = parametersUtils; this.metadataDAO = metadataDAO; } @Override - public String getTaskType() { - return TaskType.DYNAMIC.name(); + public TaskType getTaskType() { + return TaskType.DYNAMIC; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/EventTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/EventTaskMapper.java index e7bff03e35..4b97143c11 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/EventTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/EventTaskMapper.java @@ -20,6 +20,7 @@ import com.netflix.conductor.core.utils.ParametersUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Collections; @@ -33,13 +34,14 @@ public class EventTaskMapper implements TaskMapper { private final ParametersUtils parametersUtils; + @Autowired public EventTaskMapper(ParametersUtils parametersUtils) { this.parametersUtils = parametersUtils; } @Override - public String getTaskType() { - return TaskType.EVENT.name(); + public TaskType getTaskType() { + return TaskType.EVENT; } @Override diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/ExclusiveJoinTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/ExclusiveJoinTaskMapper.java index 726a9ed2cf..81e054adbe 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/ExclusiveJoinTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/ExclusiveJoinTaskMapper.java @@ -32,8 +32,8 @@ public class ExclusiveJoinTaskMapper implements TaskMapper { public static final Logger LOGGER = LoggerFactory.getLogger(ExclusiveJoinTaskMapper.class); @Override - public String getTaskType() { - return TaskType.EXCLUSIVE_JOIN.name(); + public TaskType getTaskType() { + return TaskType.EXCLUSIVE_JOIN; } @Override diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinDynamicTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinDynamicTaskMapper.java index 90cc5f61f4..e395b5f0c7 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinDynamicTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinDynamicTaskMapper.java @@ -31,6 +31,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.ArrayList; @@ -46,6 +47,7 @@ * LinkedList of {@link Task} beginning with a {@link SystemTaskType#FORK}, followed by the user defined dynamic tasks * and a {@link SystemTaskType#JOIN} at the end */ +@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Component public class ForkJoinDynamicTaskMapper implements TaskMapper { @@ -57,6 +59,7 @@ public class ForkJoinDynamicTaskMapper implements TaskMapper { private static final TypeReference> ListOfWorkflowTasks = new TypeReference>() { }; + @Autowired public ForkJoinDynamicTaskMapper(ParametersUtils parametersUtils, ObjectMapper objectMapper, MetadataDAO metadataDAO) { this.parametersUtils = parametersUtils; @@ -65,8 +68,8 @@ public ForkJoinDynamicTaskMapper(ParametersUtils parametersUtils, ObjectMapper o } @Override - public String getTaskType() { - return TaskType.FORK_JOIN_DYNAMIC.name(); + public TaskType getTaskType() { + return TaskType.FORK_JOIN_DYNAMIC; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinTaskMapper.java index 3f4f2299be..a2ae339800 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinTaskMapper.java @@ -38,8 +38,8 @@ public class ForkJoinTaskMapper implements TaskMapper { public static final Logger LOGGER = LoggerFactory.getLogger(ForkJoinTaskMapper.class); @Override - public String getTaskType() { - return TaskType.FORK_JOIN.name(); + public TaskType getTaskType() { + return TaskType.FORK_JOIN; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/HTTPTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/HTTPTaskMapper.java index dfaa0286e2..ecb901e14b 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/HTTPTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/HTTPTaskMapper.java @@ -11,6 +11,7 @@ import com.netflix.conductor.dao.MetadataDAO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Collections; @@ -23,6 +24,7 @@ * An implementation of {@link TaskMapper} to map a {@link WorkflowTask} of type {@link TaskType#HTTP} to a {@link Task} * of type {@link TaskType#HTTP} with {@link Task.Status#SCHEDULED} */ +@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Component public class HTTPTaskMapper implements TaskMapper { @@ -31,14 +33,15 @@ public class HTTPTaskMapper implements TaskMapper { private final ParametersUtils parametersUtils; private final MetadataDAO metadataDAO; + @Autowired public HTTPTaskMapper(ParametersUtils parametersUtils, MetadataDAO metadataDAO) { this.parametersUtils = parametersUtils; this.metadataDAO = metadataDAO; } @Override - public String getTaskType() { - return TaskType.HTTP.name(); + public TaskType getTaskType() { + return TaskType.HTTP; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/JoinTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/JoinTaskMapper.java index ee1742c531..58c7a04660 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/JoinTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/JoinTaskMapper.java @@ -37,8 +37,8 @@ public class JoinTaskMapper implements TaskMapper { public static final Logger LOGGER = LoggerFactory.getLogger(JoinTaskMapper.class); @Override - public String getTaskType() { - return TaskType.JOIN.name(); + public TaskType getTaskType() { + return TaskType.JOIN; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/JsonJQTransformTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/JsonJQTransformTaskMapper.java index b424999849..26dcd5e970 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/JsonJQTransformTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/JsonJQTransformTaskMapper.java @@ -41,8 +41,8 @@ public JsonJQTransformTaskMapper(ParametersUtils parametersUtils, MetadataDAO me } @Override - public String getTaskType() { - return TaskType.JSON_JQ_TRANSFORM.name(); + public TaskType getTaskType() { + return TaskType.JSON_JQ_TRANSFORM; } @Override diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/KafkaPublishTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/KafkaPublishTaskMapper.java index 103bfe04f1..2a166f2222 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/KafkaPublishTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/KafkaPublishTaskMapper.java @@ -23,6 +23,7 @@ import com.netflix.conductor.dao.MetadataDAO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Collections; @@ -31,6 +32,7 @@ import java.util.Objects; import java.util.Optional; +@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Component public class KafkaPublishTaskMapper implements TaskMapper { @@ -39,14 +41,15 @@ public class KafkaPublishTaskMapper implements TaskMapper { private final ParametersUtils parametersUtils; private final MetadataDAO metadataDAO; + @Autowired public KafkaPublishTaskMapper(ParametersUtils parametersUtils, MetadataDAO metadataDAO) { this.parametersUtils = parametersUtils; this.metadataDAO = metadataDAO; } @Override - public String getTaskType() { - return TaskType.KAFKA_PUBLISH.name(); + public TaskType getTaskType() { + return TaskType.KAFKA_PUBLISH; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/LambdaTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/LambdaTaskMapper.java index 3ea4664ede..cde93938c1 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/LambdaTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/LambdaTaskMapper.java @@ -45,8 +45,8 @@ public LambdaTaskMapper(ParametersUtils parametersUtils, MetadataDAO metadataDAO } @Override - public String getTaskType() { - return TaskType.LAMBDA.name(); + public TaskType getTaskType() { + return TaskType.LAMBDA; } @Override diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/SetVariableTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/SetVariableTaskMapper.java index b264a8a383..1f8ced1316 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/SetVariableTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/SetVariableTaskMapper.java @@ -31,8 +31,8 @@ public class SetVariableTaskMapper implements TaskMapper { public static final Logger LOGGER = LoggerFactory.getLogger(SetVariableTaskMapper.class); @Override - public String getTaskType() { - return TaskType.SET_VARIABLE.name(); + public TaskType getTaskType() { + return TaskType.SET_VARIABLE; } @Override diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/SimpleTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/SimpleTaskMapper.java index ff82a75abb..d85cb1bdfe 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/SimpleTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/SimpleTaskMapper.java @@ -44,8 +44,8 @@ public SimpleTaskMapper(ParametersUtils parametersUtils) { } @Override - public String getTaskType() { - return TaskType.SIMPLE.name(); + public TaskType getTaskType() { + return TaskType.SIMPLE; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/SubWorkflowTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/SubWorkflowTaskMapper.java index e1f21a608d..ca1c20fbfb 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/SubWorkflowTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/SubWorkflowTaskMapper.java @@ -35,8 +35,8 @@ public SubWorkflowTaskMapper(ParametersUtils parametersUtils, MetadataDAO metada } @Override - public String getTaskType() { - return TaskType.SUB_WORKFLOW.name(); + public TaskType getTaskType() { + return TaskType.SUB_WORKFLOW; } @SuppressWarnings("rawtypes") diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/TaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/TaskMapper.java index cd69a192f6..96fddee8cb 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/TaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/TaskMapper.java @@ -13,13 +13,13 @@ package com.netflix.conductor.core.execution.mapper; import com.netflix.conductor.common.metadata.tasks.Task; +import com.netflix.conductor.common.metadata.tasks.TaskType; import com.netflix.conductor.core.exception.TerminateWorkflowException; - import java.util.List; public interface TaskMapper { - String getTaskType(); + TaskType getTaskType(); List getMappedTasks(TaskMapperContext taskMapperContext) throws TerminateWorkflowException; } diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/TerminateTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/TerminateTaskMapper.java index 65624f07db..4d9f1e25fa 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/TerminateTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/TerminateTaskMapper.java @@ -38,8 +38,8 @@ public TerminateTaskMapper(ParametersUtils parametersUtils) { } @Override - public String getTaskType() { - return TaskType.TERMINATE.name(); + public TaskType getTaskType() { + return TaskType.TERMINATE; } @Override diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/UserDefinedTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/UserDefinedTaskMapper.java index f0fe52524f..d22f1293de 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/UserDefinedTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/UserDefinedTaskMapper.java @@ -48,8 +48,8 @@ public UserDefinedTaskMapper(ParametersUtils parametersUtils, MetadataDAO metada } @Override - public String getTaskType() { - return TaskType.USER_DEFINED.name(); + public TaskType getTaskType() { + return TaskType.USER_DEFINED; } /** diff --git a/core/src/main/java/com/netflix/conductor/core/execution/mapper/WaitTaskMapper.java b/core/src/main/java/com/netflix/conductor/core/execution/mapper/WaitTaskMapper.java index 2d67ee8345..4d31f76426 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/mapper/WaitTaskMapper.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/mapper/WaitTaskMapper.java @@ -42,8 +42,8 @@ public WaitTaskMapper(ParametersUtils parametersUtils) { } @Override - public String getTaskType() { - return TaskType.WAIT.name(); + public TaskType getTaskType() { + return TaskType.WAIT; } @Override