From bf060bc61cd8096d0752bf6637a92b1003f021b5 Mon Sep 17 00:00:00 2001 From: addjuarez <6789375+addjuarez@users.noreply.github.com> Date: Thu, 9 Nov 2023 18:05:20 +0000 Subject: [PATCH] Show registered workflow Signed-off-by: addjuarez <6789375+addjuarez@users.noreply.github.com> --- .../workflows/runtime/WorkflowRuntimeBuilder.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sdk-workflows/src/main/java/io/dapr/workflows/runtime/WorkflowRuntimeBuilder.java b/sdk-workflows/src/main/java/io/dapr/workflows/runtime/WorkflowRuntimeBuilder.java index b8465cdda0..f34005d4c0 100644 --- a/sdk-workflows/src/main/java/io/dapr/workflows/runtime/WorkflowRuntimeBuilder.java +++ b/sdk-workflows/src/main/java/io/dapr/workflows/runtime/WorkflowRuntimeBuilder.java @@ -16,10 +16,19 @@ import com.microsoft.durabletask.DurableTaskGrpcWorkerBuilder; import io.dapr.utils.NetworkUtils; import io.dapr.workflows.Workflow; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashSet; +import java.util.Set; public class WorkflowRuntimeBuilder { private static volatile WorkflowRuntime instance; private DurableTaskGrpcWorkerBuilder builder; + private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowRuntimeBuilder.class); + private static volatile Set activity_Set = new HashSet(); + private static volatile Set workflow_Set = new HashSet(); + public WorkflowRuntimeBuilder() { this.builder = new DurableTaskGrpcWorkerBuilder().grpcChannel(NetworkUtils.buildGrpcManagedChannel()); @@ -38,6 +47,8 @@ public WorkflowRuntime build() { } } } + LOGGER.info("List of registered workflows: " + workflow_Set); + LOGGER.info("List of registered activites: " + activity_Set); return instance; } @@ -52,7 +63,7 @@ public WorkflowRuntimeBuilder registerWorkflow(Class cla this.builder = this.builder.addOrchestration( new OrchestratorWrapper<>(clazz) ); - + WorkflowRuntimeBuilder.workflow_Set.add(clazz.getCanonicalName()); return this; } @@ -66,5 +77,6 @@ public void registerActivity(Class clazz) { this.builder = this.builder.addActivity( new ActivityWrapper<>(clazz) ); + WorkflowRuntimeBuilder.activity_Set.add(clazz.getCanonicalName()); } }