use of io.temporal.opentracing.OpenTracingClientInterceptor in project samples-java by temporalio.
the class Starter method main.
public static void main(String[] args) {
String type = "OpenTelemetry";
if (args.length == 1) {
type = args[0];
}
// Set the OpenTracing client interceptor
WorkflowClientOptions clientOptions = WorkflowClientOptions.newBuilder().setInterceptors(new OpenTracingClientInterceptor(JaegerUtils.getJaegerOptions(type))).build();
WorkflowClient client = WorkflowClient.newInstance(service, clientOptions);
WorkflowOptions workflowOptions = WorkflowOptions.newBuilder().setWorkflowId("tracingWorkflow").setTaskQueue(TASK_QUEUE_NAME).build();
// Create typed workflow stub
TracingWorkflow workflow = client.newWorkflowStub(TracingWorkflow.class, workflowOptions);
// Convert to untyped and start it with signalWithStart
WorkflowStub untyped = WorkflowStub.fromTyped(workflow);
untyped.signalWithStart("setLanguage", new Object[] { "Spanish" }, new Object[] { "John" });
String greeting = untyped.getResult(String.class);
System.out.println("Greeting: " + greeting);
System.exit(0);
}
Aggregations