/** * Invoked on the client-side to create a new instance of this exception with a proper * stack-trace containing the actual point of the service call. * * This method should be overridden by all subclasses. It will become abstract in a future release. * * @return */ protected ServiceInvocationException recreateOnClientSide() { // TODO: make this method abstract and remove malformed property return reCreateOnClientSide(null); }
/** * Sets whether service provided by the target application * should publish its versioned services. When services are * published they can be consumed from other subsystems. * * @param serviceState */ @AstrixBroadcast void setPublishServices(boolean published);
@Override public ServiceUnavailableException getThrownException() { return new ServiceUnavailableException(msg + " correlationId=" + correlationId); } }
@Override protected ServiceInvocationException recreateOnClientSide() { return new RemoteServiceInvocationException(getServiceExceptionMessage(), getExceptionType()); }
@AstrixRouting public String getServiceBeanType() { return serviceBeanType; }
private RoutingStrategy createRoutingStrategy(Method proxiedMethod) { AstrixRoutingStrategy router = proxiedMethod.getAnnotation(AstrixRoutingStrategy.class); Class<? extends RoutingStrategy> routingStrategyClass = router.value(); try { return ReflectionUtil.newInstance(routingStrategyClass); } catch (Exception e) { throw new IllegalServiceMetadataException("Failed to create RoutingStrategy", e); } }
void reThrow(CorrelationId correlationId) { ServiceInvocationException serviceInvocationException = recreateOnClientSide(); if (serviceInvocationException == null) { serviceInvocationException = this; serviceInvocationException.malformed = true; } serviceInvocationException.setCorrelationId(correlationId); throw serviceInvocationException; }
public static <T> AstrixRemoteResult<T> voidResult() { return new SuccessfulResult<>(null); }
public static CorrelationId valueOf(String id) { return new CorrelationId(id); }
public T getResult() { throw getThrownException(); }
public T getResult() { exception.reThrow(correlationId); return null; }
public static <T> AstrixRemoteResult<T> unavailable(String msg, CorrelationId correlationId) { return new ServiceUnavailableResult<T>(msg, correlationId); }
public static <T> AstrixRemoteResult<T> failure(ServiceInvocationException exception, CorrelationId correlationId) { return new ServiceInvocationExceptionResult<>(exception, correlationId); }
@AstrixBroadcast(reducer = LunchRestaurantGradeReducer.class) LunchRestaurantGrade getHighestGrade(); }
private UnaryOperator<Exception> serviceUnavailable() { return e -> new ServiceUnavailableException("Failed to submit remote invocation task", e); }
List<AstrixServiceRegistryEntry> listServices(@AstrixRouting String type, String qualifier); }
public static <T> AstrixRemoteResult<T> successful(T result) { return new SuccessfulResult<>(result); }
public static CorrelationId undefined() { return new CorrelationId("-"); }
@AstrixBroadcast List<AstrixServiceRegistryEntry> listServices();