From 1f673786e4f37817b45b34af9ebbbe5c93ecef09 Mon Sep 17 00:00:00 2001 From: Quinn Klassen Date: Wed, 16 Oct 2024 12:40:23 -0700 Subject: [PATCH 1/3] Add snip sync --- .../io/temporal/samples/nexus/caller/CallerStarter.java | 2 ++ .../java/io/temporal/samples/nexus/caller/CallerWorker.java | 2 ++ .../io/temporal/samples/nexus/handler/HandlerWorker.java | 2 ++ .../io/temporal/samples/nexus/handler/NexusServiceImpl.java | 2 ++ .../io/temporal/samples/nexus/options/ClientOptions.java | 6 ++++++ .../io/temporal/samples/nexus/service/NexusService.java | 2 ++ 6 files changed, 16 insertions(+) diff --git a/core/src/main/java/io/temporal/samples/nexus/caller/CallerStarter.java b/core/src/main/java/io/temporal/samples/nexus/caller/CallerStarter.java index be1cc788e..ca38aa17d 100644 --- a/core/src/main/java/io/temporal/samples/nexus/caller/CallerStarter.java +++ b/core/src/main/java/io/temporal/samples/nexus/caller/CallerStarter.java @@ -1,3 +1,4 @@ +// @@@SNIPSTART samples-java-nexus-caller-starter package io.temporal.samples.nexus.caller; import io.temporal.api.common.v1.WorkflowExecution; @@ -34,3 +35,4 @@ public static void main(String[] args) { logger.info("Workflow result: {}", helloWorkflow.hello("Nexus", NexusService.Language.ES)); } } +// @@@SNIPEND \ No newline at end of file diff --git a/core/src/main/java/io/temporal/samples/nexus/caller/CallerWorker.java b/core/src/main/java/io/temporal/samples/nexus/caller/CallerWorker.java index 55186489e..149587f8c 100644 --- a/core/src/main/java/io/temporal/samples/nexus/caller/CallerWorker.java +++ b/core/src/main/java/io/temporal/samples/nexus/caller/CallerWorker.java @@ -1,3 +1,4 @@ +// @@@SNIPSTART samples-java-nexus-caller-worker package io.temporal.samples.nexus.caller; import io.temporal.client.WorkflowClient; @@ -30,3 +31,4 @@ public static void main(String[] args) { factory.start(); } } +// @@@SNIPEND \ No newline at end of file diff --git a/core/src/main/java/io/temporal/samples/nexus/handler/HandlerWorker.java b/core/src/main/java/io/temporal/samples/nexus/handler/HandlerWorker.java index 3d8afa3d7..7aafba4f3 100644 --- a/core/src/main/java/io/temporal/samples/nexus/handler/HandlerWorker.java +++ b/core/src/main/java/io/temporal/samples/nexus/handler/HandlerWorker.java @@ -1,3 +1,4 @@ +// @@@SNIPSTART samples-java-nexus-handler-worker package io.temporal.samples.nexus.handler; import io.temporal.client.WorkflowClient; @@ -20,3 +21,4 @@ public static void main(String[] args) { factory.start(); } } +// @@@SNIPEND diff --git a/core/src/main/java/io/temporal/samples/nexus/handler/NexusServiceImpl.java b/core/src/main/java/io/temporal/samples/nexus/handler/NexusServiceImpl.java index 2344f27ec..c051e0e1d 100644 --- a/core/src/main/java/io/temporal/samples/nexus/handler/NexusServiceImpl.java +++ b/core/src/main/java/io/temporal/samples/nexus/handler/NexusServiceImpl.java @@ -8,6 +8,7 @@ import io.temporal.nexus.WorkflowRunOperation; import io.temporal.samples.nexus.service.NexusService; +// @@@SNIPSTART samples-java-nexus-handler // To create a service implementation, annotate the class with @ServiceImpl and provide the // interface that the service implements. The service implementation class should have methods that // return OperationHandler that correspond to the operations defined in the service interface. @@ -51,3 +52,4 @@ public OperationHandler hello ::hello); } } +// @@@SNIPEND diff --git a/core/src/main/java/io/temporal/samples/nexus/options/ClientOptions.java b/core/src/main/java/io/temporal/samples/nexus/options/ClientOptions.java index 5d382eaab..0bcb12ab3 100644 --- a/core/src/main/java/io/temporal/samples/nexus/options/ClientOptions.java +++ b/core/src/main/java/io/temporal/samples/nexus/options/ClientOptions.java @@ -1,3 +1,4 @@ +// @@@SNIPSTART samples-java-nexus-cli package io.temporal.samples.nexus.options; import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts; @@ -7,10 +8,14 @@ import io.temporal.client.WorkflowClientOptions; import io.temporal.serviceclient.WorkflowServiceStubs; import io.temporal.serviceclient.WorkflowServiceStubsOptions; +import org.apache.commons.cli.*; + +import javax.net.ssl.SSLException; import java.io.FileInputStream; import java.io.FileNotFoundException; import javax.net.ssl.SSLException; import org.apache.commons.cli.*; +import java.util.Arrays; public class ClientOptions { @@ -129,3 +134,4 @@ public static WorkflowClient getWorkflowClient( return WorkflowClient.newInstance(service, clientOptions.setNamespace(namespace).build()); } } +// @@@SNIPEND \ No newline at end of file diff --git a/core/src/main/java/io/temporal/samples/nexus/service/NexusService.java b/core/src/main/java/io/temporal/samples/nexus/service/NexusService.java index ad65b1b33..2f045f875 100644 --- a/core/src/main/java/io/temporal/samples/nexus/service/NexusService.java +++ b/core/src/main/java/io/temporal/samples/nexus/service/NexusService.java @@ -5,6 +5,7 @@ import io.nexusrpc.Operation; import io.nexusrpc.Service; +// @@@SNIPSTART samples-java-nexus-service @Service public interface NexusService { enum Language { @@ -85,3 +86,4 @@ public String getMessage() { @Operation EchoOutput echo(EchoInput input); } +// @@@SNIPEND From 207626544ca5fedb98e3ca737b04ec765bb85478 Mon Sep 17 00:00:00 2001 From: Quinn Klassen Date: Wed, 16 Oct 2024 12:51:18 -0700 Subject: [PATCH 2/3] Add more snip sync --- .../temporal/samples/nexus/caller/EchoCallerWorkflowImpl.java | 2 ++ .../temporal/samples/nexus/caller/HelloCallerWorkflowImpl.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/core/src/main/java/io/temporal/samples/nexus/caller/EchoCallerWorkflowImpl.java b/core/src/main/java/io/temporal/samples/nexus/caller/EchoCallerWorkflowImpl.java index 948008772..49083301b 100644 --- a/core/src/main/java/io/temporal/samples/nexus/caller/EchoCallerWorkflowImpl.java +++ b/core/src/main/java/io/temporal/samples/nexus/caller/EchoCallerWorkflowImpl.java @@ -1,3 +1,4 @@ +// @@@SNIPSTART samples-java-nexus-caller-echo-workflow package io.temporal.samples.nexus.caller; import io.temporal.samples.nexus.service.NexusService; @@ -22,3 +23,4 @@ public String echo(String message) { return nexusService.echo(new NexusService.EchoInput(message)).getMessage(); } } +// @@@SNIPEND diff --git a/core/src/main/java/io/temporal/samples/nexus/caller/HelloCallerWorkflowImpl.java b/core/src/main/java/io/temporal/samples/nexus/caller/HelloCallerWorkflowImpl.java index f1612e359..55fc1ee54 100644 --- a/core/src/main/java/io/temporal/samples/nexus/caller/HelloCallerWorkflowImpl.java +++ b/core/src/main/java/io/temporal/samples/nexus/caller/HelloCallerWorkflowImpl.java @@ -1,3 +1,4 @@ +// @@@SNIPSTART samples-java-nexus-caller-hello-workflow package io.temporal.samples.nexus.caller; import io.temporal.samples.nexus.service.NexusService; @@ -29,3 +30,4 @@ public String hello(String message, NexusService.Language language) { return handle.getResult().get().getMessage(); } } +// @@@SNIPEND From 65a5c65a412bd259129f84cccf618bd0e327eba1 Mon Sep 17 00:00:00 2001 From: Quinn Klassen Date: Wed, 25 Jun 2025 16:24:41 -0700 Subject: [PATCH 3/3] Add snip sync for multiargs --- .../samples/nexusmultipleargs/handler/NexusServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/io/temporal/samples/nexusmultipleargs/handler/NexusServiceImpl.java b/core/src/main/java/io/temporal/samples/nexusmultipleargs/handler/NexusServiceImpl.java index 20d55fed8..38d8c52c0 100644 --- a/core/src/main/java/io/temporal/samples/nexusmultipleargs/handler/NexusServiceImpl.java +++ b/core/src/main/java/io/temporal/samples/nexusmultipleargs/handler/NexusServiceImpl.java @@ -9,6 +9,7 @@ import io.temporal.nexus.WorkflowRunOperation; import io.temporal.samples.nexus.service.NexusService; +// @@@SNIPSTART samples-java-nexus-handler-multiargs // To create a service implementation, annotate the class with @ServiceImpl and provide the // interface that the service implements. The service implementation class should have methods that // return OperationHandler that correspond to the operations defined in the service interface. @@ -58,3 +59,4 @@ public OperationHandler hello input.getLanguage())); } } +// @@@SNIPEND