/** * Create a new {@code RemoteInvocation} object for the given AOP method invocation. * <p>The default implementation delegates to the {@link RemoteInvocationFactory}. * <p>Can be overridden in subclasses to provide custom {@code RemoteInvocation} * subclasses, containing additional invocation parameters like user credentials. * Note that it is preferable to use a custom {@code RemoteInvocationFactory} which * is a reusable strategy. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return this.remoteInvocationFactory.createRemoteInvocation(methodInvocation); }
/** * Create a new RemoteInvocation object for the given AOP method invocation. * <p>The default implementation delegates to the configured * {@link #setRemoteInvocationFactory RemoteInvocationFactory}. * This can be overridden in subclasses in order to provide custom RemoteInvocation * subclasses, containing additional invocation parameters (e.g. user credentials). * <p>Note that it is preferable to build a custom RemoteInvocationFactory * as a reusable strategy, instead of overriding this method. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return getRemoteInvocationFactory().createRemoteInvocation(methodInvocation); }
/** * Create a new RemoteInvocation object for the given AOP method invocation. * <p>The default implementation delegates to the configured * {@link #setRemoteInvocationFactory RemoteInvocationFactory}. * This can be overridden in subclasses in order to provide custom RemoteInvocation * subclasses, containing additional invocation parameters (e.g. user credentials). * <p>Note that it is preferable to build a custom RemoteInvocationFactory * as a reusable strategy, instead of overriding this method. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return getRemoteInvocationFactory().createRemoteInvocation(methodInvocation); }
/** * Create a new RemoteInvocation object for the given AOP method invocation. * <p>The default implementation delegates to the configured * {@link #setRemoteInvocationFactory RemoteInvocationFactory}. * This can be overridden in subclasses in order to provide custom RemoteInvocation * subclasses, containing additional invocation parameters (e.g. user credentials). * <p>Note that it is preferable to build a custom RemoteInvocationFactory * as a reusable strategy, instead of overriding this method. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return getRemoteInvocationFactory().createRemoteInvocation(methodInvocation); }
/** * Create a new RemoteInvocation object for the given AOP method invocation. * <p>The default implementation delegates to the configured * {@link #setRemoteInvocationFactory RemoteInvocationFactory}. * This can be overridden in subclasses in order to provide custom RemoteInvocation * subclasses, containing additional invocation parameters (e.g. user credentials). * <p>Note that it is preferable to build a custom RemoteInvocationFactory * as a reusable strategy, instead of overriding this method. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return getRemoteInvocationFactory().createRemoteInvocation(methodInvocation); }
/** * Create a new RemoteInvocation object for the given AOP method invocation. * The default implementation delegates to the RemoteInvocationFactory. * <p>Can be overridden in subclasses to provide custom RemoteInvocation * subclasses, containing additional invocation parameters like user credentials. * Note that it is preferable to use a custom RemoteInvocationFactory which * is a reusable strategy. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return this.remoteInvocationFactory.createRemoteInvocation(methodInvocation); }
/** * Create a new {@code RemoteInvocation} object for the given AOP method invocation. * <p>The default implementation delegates to the {@link RemoteInvocationFactory}. * <p>Can be overridden in subclasses to provide custom {@code RemoteInvocation} * subclasses, containing additional invocation parameters like user credentials. * Note that it is preferable to use a custom {@code RemoteInvocationFactory} which * is a reusable strategy. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return this.remoteInvocationFactory.createRemoteInvocation(methodInvocation); }
/** * Create a new {@code RemoteInvocation} object for the given AOP method invocation. * <p>The default implementation delegates to the {@link RemoteInvocationFactory}. * <p>Can be overridden in subclasses to provide custom {@code RemoteInvocation} * subclasses, containing additional invocation parameters like user credentials. * Note that it is preferable to use a custom {@code RemoteInvocationFactory} which * is a reusable strategy. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return this.remoteInvocationFactory.createRemoteInvocation(methodInvocation); }
/** * Create a new RemoteInvocation object for the given AOP method invocation. * <p>The default implementation delegates to the configured * {@link #setRemoteInvocationFactory RemoteInvocationFactory}. * This can be overridden in subclasses in order to provide custom RemoteInvocation * subclasses, containing additional invocation parameters (e.g. user credentials). * <p>Note that it is preferable to build a custom RemoteInvocationFactory * as a reusable strategy, instead of overriding this method. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return getRemoteInvocationFactory().createRemoteInvocation(methodInvocation); }
/** * Create a new RemoteInvocation object for the given AOP method invocation. * <p>The default implementation delegates to the configured * {@link #setRemoteInvocationFactory RemoteInvocationFactory}. * This can be overridden in subclasses in order to provide custom RemoteInvocation * subclasses, containing additional invocation parameters (e.g. user credentials). * <p>Note that it is preferable to build a custom RemoteInvocationFactory * as a reusable strategy, instead of overriding this method. * @param methodInvocation the current AOP method invocation * @return the RemoteInvocation object * @see RemoteInvocationFactory#createRemoteInvocation */ protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) { return getRemoteInvocationFactory().createRemoteInvocation(methodInvocation); }
@Override public Object invoke(MethodInvocation invocation) throws Throwable { RemoteInvocation remoteInvocation = getRemoteInvocationFactory().createRemoteInvocation(invocation); Object rawResult; if (getRoutingKey() == null) { // Use the template's default routing key rawResult = this.amqpTemplate.convertSendAndReceive(remoteInvocation); } else { rawResult = this.amqpTemplate.convertSendAndReceive(this.routingKey, remoteInvocation); } if (rawResult == null) { throw new RemoteProxyFailureException("No reply received from '" + remoteInvocation.getMethodName() + "' with arguments '" + Arrays.asList(remoteInvocation.getArguments()) + // NOSONAR (null) "' - perhaps a timeout in the template?", null); } else if (!(rawResult instanceof RemoteInvocationResult)) { throw new RemoteProxyFailureException("Expected a result of type " + RemoteInvocationResult.class.getCanonicalName() + " but found " + rawResult.getClass().getCanonicalName(), null); // NOSONAR (null) } RemoteInvocationResult result = (RemoteInvocationResult) rawResult; return result.recreate(); }