Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Java SDK #705

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ subprojects {
ext {
otelVersion = '1.30.1'
otelVersionAlpha = "${otelVersion}-alpha"
javaSDKVersion = '1.26.1'
javaSDKVersion = '1.27.0'
camelVersion = '3.22.1'
jarVersion = '1.0.0'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

package io.temporal.samples.countinterceptor;

import io.temporal.common.interceptors.ActivityInboundCallsInterceptor;
import io.temporal.common.interceptors.WorkerInterceptor;
import io.temporal.common.interceptors.WorkflowInboundCallsInterceptor;
import io.nexusrpc.handler.OperationContext;
import io.temporal.common.interceptors.*;
import io.temporal.internal.sync.BaseRootWorkflowInboundCallsInterceptor;

public class SimpleCountWorkerInterceptor implements WorkerInterceptor {
public class SimpleCountWorkerInterceptor extends WorkerInterceptorBase {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To provide a base implementation for Nexus.


@Override
public WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInterceptor next) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,13 @@ private static void runWorkflowWithUpdateWithStart(WorkflowClient client) {

System.out.println("Starting workflow with UpdateWithStart");

UpdateWithStartWorkflowOperation<TxResult> updateOp =
UpdateWithStartWorkflowOperation.newBuilder(workflow::returnInitResult)
.setWaitForStage(WorkflowUpdateStage.COMPLETED) // Wait for update to complete
.build();

TxResult updateResult = null;
try {
WorkflowUpdateHandle<TxResult> updateHandle =
WorkflowClient.updateWithStart(workflow::processTransaction, txRequest, updateOp);

updateResult = updateHandle.getResultAsync().get();
updateResult =
WorkflowClient.executeUpdateWithStart(
workflow::returnInitResult,
UpdateOptions.<TxResult>newBuilder().build(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much cleaner implementation!

new WithStartWorkflowOperation<>(workflow::processTransaction, txRequest));

System.out.println(
"Workflow initialized with result: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

package io.temporal.samples.excludefrominterceptor.interceptor;

import io.temporal.common.interceptors.ActivityInboundCallsInterceptor;
import io.temporal.common.interceptors.WorkerInterceptor;
import io.temporal.common.interceptors.WorkflowInboundCallsInterceptor;
import io.nexusrpc.handler.OperationContext;
import io.temporal.common.interceptors.*;

import java.util.ArrayList;
import java.util.List;

public class MyWorkerInterceptor implements WorkerInterceptor {
public class MyWorkerInterceptor extends WorkerInterceptorBase {
private List<String> excludeWorkflowTypes = new ArrayList<>();
private List<String> excludeActivityTypes = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@

package io.temporal.samples.retryonsignalinterceptor;

import io.temporal.common.interceptors.ActivityInboundCallsInterceptor;
import io.temporal.common.interceptors.WorkerInterceptor;
import io.temporal.common.interceptors.WorkflowInboundCallsInterceptor;
import io.nexusrpc.handler.OperationContext;
import io.temporal.common.interceptors.*;

/** Should be registered through WorkerFactoryOptions. */
public class RetryOnSignalWorkerInterceptor implements WorkerInterceptor {
public class RetryOnSignalWorkerInterceptor extends WorkerInterceptorBase {
@Override
public WorkflowInboundCallsInterceptor interceptWorkflow(WorkflowInboundCallsInterceptor next) {
return new RetryOnSignalWorkflowInboundCallsInterceptor(next);
Expand Down
Loading