All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.sixpack.api.rpc.RegistrationW Maven / Gradle / Ivy

The newest version!
package dev.sixpack.api.rpc;

import dev.sixpack.api.data.Manifest;
import dev.sixpack.api.data.RegistrationResult;
import io.temporal.client.WorkflowOptions;
import io.temporal.common.RetryOptions;
import io.temporal.workflow.WorkflowInterface;
import io.temporal.workflow.WorkflowMethod;

import static dev.sixpack.api.rpc.NormalisationUtils.safe;
import static io.temporal.api.enums.v1.WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE;

@WorkflowInterface
public interface RegistrationW {

    interface Options {
        String WAREHOUSE_INBOUND_QUEUE = "warehouse_queue";

        static WorkflowOptions get(String environment, String supplier) {
            return WorkflowOptions.newBuilder()
                    .setTaskQueue(WAREHOUSE_INBOUND_QUEUE)
                    .setWorkflowId(safe(environment + "_" + supplier))
                    .setWorkflowIdReusePolicy(WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE)
                    .setRetryOptions(RetryOptions.newBuilder()
                            .setMaximumAttempts(1)
                            .validateBuildWithDefaults())
                    .validateBuildWithDefaults();
        }
    }

    @WorkflowMethod
    RegistrationResult register(String tenant, Manifest manifest);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy