assertEquals("setName", inv.getMethodName()); assertEquals("bla", inv.getArguments()[0]); assertEquals(String.class, inv.getParameterTypes()[0]); assertEquals("bla", inv.getArguments()[0]); inv.setMethodName("setName"); assertEquals("setName", inv.getMethodName()); inv.setParameterTypes(new Class<?>[] {String.class}); assertEquals(String.class, inv.getParameterTypes()[0]); assertEquals("setName", inv.getMethodName()); assertEquals(String.class, inv.getParameterTypes()[0]);
protected Object doTransform(Object src, String encoding) throws TransformerException { if (src instanceof RemoteInvocation) { return src; } try { byte[] data = (byte[])src; ByteArrayInputStream bais = new ByteArrayInputStream(data); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); RemoteInvocation ri = (RemoteInvocation)o; if (logger.isDebugEnabled()) { logger.debug("request to execute " + ri.getMethodName()); for (int i = 0; i < ri.getArguments().length; i++) { Object a = ri.getArguments()[i]; logger.debug("with argument (" + a.toString() + ")"); } } return ri; } catch (Exception e) { throw new TransformerException(this, e); } }
protected boolean isEndSessionMethod(RemoteInvocation invocation) { Method method; try { method = getProxy().getClass().getMethod(invocation.getMethodName(), invocation.getParameterTypes()); } catch (Exception e) { onException(invocation, e); return false; } return metadataStrategy.getMethodMetadata(method).isEndSession(); }
if (logger.isDebugEnabled()) logger.debug("request to execute " + ri.getMethodName()); for (int i = 0; i < ri.getArguments().length; i++)
@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(); }