dev.sixpack.api.rpc.GenerationW Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sixpack-sdk Show documentation
Show all versions of sixpack-sdk Show documentation
SDK to develop generators part of the Sixpack solution
The newest version!
package dev.sixpack.api.rpc;
import dev.sixpack.api.data.Request;
import dev.sixpack.api.data.Result;
import io.temporal.common.RetryOptions;
import io.temporal.workflow.ChildWorkflowOptions;
import io.temporal.workflow.WorkflowInterface;
import io.temporal.workflow.WorkflowMethod;
import java.time.Duration;
import static dev.sixpack.api.rpc.NormalisationUtils.safe;
import static io.temporal.api.enums.v1.ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE;
import static io.temporal.api.enums.v1.WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE;
import static java.time.Duration.ofMinutes;
@WorkflowInterface
public interface GenerationW {
static ChildWorkflowOptions childOptions(String environment,
String supplier,
String item,
String id,
int iteration) {
return ChildWorkflowOptions.newBuilder()
.setParentClosePolicy(PARENT_CLOSE_POLICY_TERMINATE)
.setTaskQueue(safe(environment + "_" + supplier + "_" + item))
.setWorkflowId(id + "_" + iteration)
.setWorkflowIdReusePolicy(WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE)
.setRetryOptions(RetryOptions.newBuilder()
.setInitialInterval(Duration.ofSeconds(30))
.setBackoffCoefficient(2D)
.setMaximumInterval(ofMinutes(2))
.setMaximumAttempts(5)
.validateBuildWithDefaults())
.validateAndBuildWithDefaults();
}
@WorkflowMethod
Result generate(Request request);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy