feign.hystrix.FallbackFactory Java Examples

The following examples show how to use feign.hystrix.FallbackFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BladeHystrixTargeter.java    From blade-tool with GNU Lesser General Public License v3.0 5 votes vote down vote up
private <T> T targetWithFallbackFactory(String feignClientName, FeignContext context,
										Target.HardCodedTarget<T> target,
										HystrixFeign.Builder builder,
										Class<?> fallbackFactoryClass) {
	FallbackFactory<? extends T> fallbackFactory = (FallbackFactory<? extends T>)
		getFromContext("fallbackFactory", feignClientName, context, fallbackFactoryClass, FallbackFactory.class);
	return builder.target(target, fallbackFactory);
}
 
Example #2
Source File: SentinelInvocationHandler.java    From spring-cloud-alibaba with Apache License 2.0 5 votes vote down vote up
SentinelInvocationHandler(Target<?> target, Map<Method, MethodHandler> dispatch,
		FallbackFactory fallbackFactory) {
	this.target = checkNotNull(target, "target");
	this.dispatch = checkNotNull(dispatch, "dispatch");
	this.fallbackFactory = fallbackFactory;
	this.fallbackMethodMap = toFallbackMethod(dispatch);
}
 
Example #3
Source File: HystrixFeignBuilder.java    From onetwo with Apache License 2.0 5 votes vote down vote up
/** Configures components needed for hystrix integration. */
Feign build(final FallbackFactory<?> nullableFallbackFactory) {
  super.invocationHandlerFactory(new InvocationHandlerFactory() {
    @Override public InvocationHandler create(Target target,
        Map<Method, MethodHandler> dispatch) {
      return new EnhanceInvocationHandler(target, dispatch, setterFactory, nullableFallbackFactory);
    }
  });
  super.contract(new HystrixDelegatingContract(contract));
  return super.build();
}
 
Example #4
Source File: EnhanceInvocationHandler.java    From onetwo with Apache License 2.0 5 votes vote down vote up
public EnhanceInvocationHandler(Target<?> target, Map<Method, MethodHandler> dispatch,
                         SetterFactory setterFactory, FallbackFactory<?> fallbackFactory) {
  this.target = checkNotNull(target, "target");
  this.dispatch = checkNotNull(dispatch, "dispatch");
  this.fallbackFactory = fallbackFactory;
  this.fallbackMethodMap = toFallbackMethod(dispatch);
  this.setterMethodMap = toSetters(setterFactory, target, dispatch.keySet());
}
 
Example #5
Source File: CompensableHystrixFallbackFactoryHandler.java    From ByteTCC with GNU Lesser General Public License v3.0 4 votes vote down vote up
public CompensableHystrixFallbackFactoryHandler(FallbackFactory<?> fallbackFactory, Class<?> fallbackType) {
	this.fallbackFactory = fallbackFactory;
	this.fallbackType = fallbackType;
}
 
Example #6
Source File: CompensableHystrixFallbackFactoryHandler.java    From ByteTCC with GNU Lesser General Public License v3.0 4 votes vote down vote up
public FallbackFactory<?> getFallbackFactory() {
	return fallbackFactory;
}
 
Example #7
Source File: TransactionHystrixFallbackFactoryHandler.java    From ByteJTA with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TransactionHystrixFallbackFactoryHandler(FallbackFactory<?> fallbackFactory, Class<?> fallbackType) {
	this.fallbackFactory = fallbackFactory;
	this.fallbackType = fallbackType;
}
 
Example #8
Source File: TransactionHystrixFallbackFactoryHandler.java    From ByteJTA with GNU Lesser General Public License v3.0 4 votes vote down vote up
public FallbackFactory<?> getFallbackFactory() {
	return fallbackFactory;
}
 
Example #9
Source File: HystrixFeignBuilder.java    From onetwo with Apache License 2.0 2 votes vote down vote up
/**
 * Same as {@link #target(Class, String, T)}, except you can inspect a source exception before
 * creating a fallback object.
 */
public <T> T target(Class<T> apiType, String url, FallbackFactory<? extends T> fallbackFactory) {
  return target(new Target.HardCodedTarget<T>(apiType, url), fallbackFactory);
}