Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
import io.dapr.workflows.WorkflowActivity;
import io.dapr.workflows.runtime.WorkflowRuntime;
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;
import io.micrometer.common.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.Map;

Expand Down Expand Up @@ -54,8 +56,19 @@ private void registerWorkflowsAndActivities(ApplicationContext applicationContex
Map<String, WorkflowActivity> workflowActivitiesBeans = applicationContext.getBeansOfType(WorkflowActivity.class);

for (WorkflowActivity activity : workflowActivitiesBeans.values()) {
LOGGER.info("Dapr Workflow Activity: '{}' registered", activity.getClass().getName());
// Get the @Component annotation
Component componentAnnotation = activity.getClass().getAnnotation(Component.class);

if (componentAnnotation != null) {
var componentValue = componentAnnotation.value();
if (StringUtils.isNotEmpty(componentValue)) {
LOGGER.info("Dapr Workflow Activity: '{}' with name '{}' registered", activity.getClass().getName(), componentValue);
workflowRuntimeBuilder.registerActivity(componentValue, activity);
return;
}
}

LOGGER.info("Dapr Workflow Activity: '{}' registered", activity.getClass().getName());
workflowRuntimeBuilder.registerActivity(activity);
}

Expand Down
Loading