org.zalando.riptide.faults.TransientFaultPlugin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riptide-faults Show documentation
Show all versions of riptide-faults Show documentation
Client side response routing
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