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

org.zalando.riptide.faults.TransientFaultPlugin Maven / Gradle / Ivy

There is a newer version: 4.1.0
Show newest version
package org.zalando.riptide.faults;

import org.apiguardian.api.API;
import org.zalando.riptide.Plugin;
import org.zalando.riptide.RequestExecution;

import static org.apiguardian.api.API.Status.STABLE;
import static org.zalando.fauxpas.FauxPas.partially;

@API(status = STABLE)
public final class TransientFaultPlugin implements Plugin {

    private final FaultClassifier classifier;

    public TransientFaultPlugin() {
        this(new DefaultFaultClassifier());
    }

    public TransientFaultPlugin(final FaultClassifier classifier) {
        this.classifier = classifier;
    }

    @Override
    public RequestExecution aroundNetwork(final RequestExecution execution) {
        return arguments -> execution.execute(arguments)
                .exceptionally(partially(classifier::classifyExceptionally));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy