Skip to content

Commit 737f666

Browse files
committed
wip: wip
Signed-off-by: Javier Aliaga <[email protected]>
1 parent e4b6ba1 commit 737f666

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

dapr-spring/dapr-spring-workflows/src/main/java/io/dapr/spring/workflows/config/DaprWorkflowsConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,12 @@ private void registerWorkflowsAndActivities(ApplicationContext applicationContex
5858
for (WorkflowActivity activity : workflowActivitiesBeans.values()) {
5959
// Get the @Component annotation
6060
Component componentAnnotation = activity.getClass().getAnnotation(Component.class);
61-
61+
activity.getName()
6262
if (componentAnnotation != null) {
6363
var componentValue = componentAnnotation.value();
6464
if (StringUtils.isNotEmpty(componentValue)) {
6565
LOGGER.info("Dapr Workflow Activity: '{}' with name '{}' registered", activity.getClass().getName(), componentValue);
6666
workflowRuntimeBuilder.registerActivity(componentValue, activity);
67-
return;
6867
}
6968
}
7069

examples/src/main/java/io/dapr/examples/workflows/continueasnew/CleanUpActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import java.util.concurrent.TimeUnit;
2222

23+
2324
public class CleanUpActivity implements WorkflowActivity {
2425
@Override
2526
public Object run(WorkflowActivityContext ctx) {

sdk-workflows/src/main/java/io/dapr/workflows/WorkflowActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@ public interface WorkflowActivity {
4242
* @return any serializable value to be returned to the calling orchestrator.
4343
*/
4444
Object run(WorkflowActivityContext ctx);
45+
46+
default String getName() {
47+
return this.getClass().getCanonicalName();
48+
}
4549
}

sdk-workflows/src/main/java/io/dapr/workflows/runtime/WorkflowRuntimeBuilder.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,23 @@ public <T extends Workflow> WorkflowRuntimeBuilder registerWorkflow(Class<T> cla
116116
this.builder.addOrchestration(new WorkflowClassWrapper<>(clazz));
117117
this.workflowSet.add(clazz.getCanonicalName());
118118
this.workflows.add(clazz.getSimpleName());
119+
120+
this.logger.info("Registered Workflow: {}", clazz.getSimpleName());
121+
122+
return this;
123+
}
124+
125+
/**
126+
* Registers a Workflow object.
127+
*
128+
* @param <T> any Workflow type
129+
* @param clazz the class being registered
130+
* @return the WorkflowRuntimeBuilder
131+
*/
132+
public <T extends Workflow> WorkflowRuntimeBuilder registerWorkflow(String name, Class<T> clazz) {
133+
this.builder.addOrchestration(new WorkflowClassWrapper<>(clazz));
134+
this.workflowSet.add(name);
135+
this.workflows.add(name);
119136

120137
this.logger.info("Registered Workflow: {}", clazz.getSimpleName());
121138

0 commit comments

Comments
 (0)