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

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

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

import dev.sixpack.api.data.Request;
import dev.sixpack.api.data.Result;
import dev.sixpack.generator.FactoryController;
import io.temporal.activity.ActivityInterface;
import io.temporal.activity.ActivityMethod;
import io.temporal.activity.ActivityOptions;

import static dev.sixpack.api.rpc.NormalisationUtils.safe;
import static io.temporal.common.RetryOptions.newBuilder;
import static java.time.Duration.ofMinutes;

@ActivityInterface
public interface GeneratorA {

    static ActivityOptions options(String environment, String supplier, String item) {
        return ActivityOptions.newBuilder()
                .setScheduleToStartTimeout(ofMinutes(100))
                .setStartToCloseTimeout(ofMinutes(5))
                .setTaskQueue(safe(environment + "_" + supplier + "_" + item))
                .setRetryOptions(newBuilder()
                        .setInitialInterval(FactoryController.INITIAL_INTERVAL)
                        .setBackoffCoefficient(FactoryController.BACKOFF_COEFFICIENT)
                        .setMaximumInterval(FactoryController.MAXIMUM_INTERVAL)
                        .setMaximumAttempts(FactoryController.MAX_RETRIES)
                        .build())
                .build();
    }

    @ActivityMethod
    Result generate(Request request);

    @ActivityMethod
    Result configure(Request request);

    @ActivityMethod
    Result cleanup(Request request);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy