@Override public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) { InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(bean, method); handlerMethod.setMessageMethodArgumentResolvers(this.argumentResolvers); return handlerMethod; }
protected void processHandlerMethodException(HandlerMethod handlerMethod, Exception exception, Message<?> message) { InvocableHandlerMethod invocable = getExceptionHandlerMethod(handlerMethod, exception); if (invocable == null) { logger.error("Unhandled exception from message handler method", exception); return; } invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); if (logger.isDebugEnabled()) { logger.debug("Invoking " + invocable.getShortLogMessage()); } try { Throwable cause = exception.getCause(); Object returnValue = (cause != null ? invocable.invoke(message, exception, cause, handlerMethod) : invocable.invoke(message, exception, handlerMethod)); MethodParameter returnType = invocable.getReturnType(); if (void.class == returnType.getParameterType()) { return; } this.returnValueHandlers.handleReturnValue(returnValue, returnType, message); } catch (Throwable ex2) { logger.error("Error while processing handler method exception", ex2); } }
@Nullable private Object invoke(Object handler, Method method, Object... providedArgs) throws Exception { InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(handler, method); handlerMethod.setMessageMethodArgumentResolvers(this.resolvers); return handlerMethod.invoke(this.message, providedArgs); }
invocable.setLogger(this.handlerMethodLogger); invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); try { Object returnValue = invocable.invoke(message);
@Override public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) { InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(bean, method); handlerMethod.setMessageMethodArgumentResolvers(this.argumentResolvers); return handlerMethod; }
protected void processHandlerMethodException(HandlerMethod handlerMethod, Exception exception, Message<?> message) { InvocableHandlerMethod invocable = getExceptionHandlerMethod(handlerMethod, exception); if (invocable == null) { logger.error("Unhandled exception from message handler method", exception); return; } invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); if (logger.isDebugEnabled()) { logger.debug("Invoking " + invocable.getShortLogMessage()); } try { Throwable cause = exception.getCause(); Object returnValue = (cause != null ? invocable.invoke(message, exception, cause, handlerMethod) : invocable.invoke(message, exception, handlerMethod)); MethodParameter returnType = invocable.getReturnType(); if (void.class == returnType.getParameterType()) { return; } this.returnValueHandlers.handleReturnValue(returnValue, returnType, message); } catch (Throwable ex2) { logger.error("Error while processing handler method exception", ex2); } }
invocable.setLogger(this.handlerMethodLogger); invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); try { Object returnValue = invocable.invoke(message);
@Override public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) { InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(bean, method); handlerMethod.setMessageMethodArgumentResolvers(this.argumentResolvers); return handlerMethod; }
@Override public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) { InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(bean, method); handlerMethod.setMessageMethodArgumentResolvers(this.argumentResolvers); return handlerMethod; }
protected void processHandlerMethodException(HandlerMethod handlerMethod, Exception exception, Message<?> message) { InvocableHandlerMethod invocable = getExceptionHandlerMethod(handlerMethod, exception); if (invocable == null) { logger.error("Unhandled exception from message handler method", exception); return; } invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); if (logger.isDebugEnabled()) { logger.debug("Invoking " + invocable.getShortLogMessage()); } try { Throwable cause = exception.getCause(); Object returnValue = (cause != null ? invocable.invoke(message, exception, cause, handlerMethod) : invocable.invoke(message, exception, handlerMethod)); MethodParameter returnType = invocable.getReturnType(); if (void.class == returnType.getParameterType()) { return; } this.returnValueHandlers.handleReturnValue(returnValue, returnType, message); } catch (Throwable ex2) { logger.error("Error while processing handler method exception", ex2); } }
protected void processHandlerMethodException(HandlerMethod handlerMethod, Exception exception, Message<?> message) { InvocableHandlerMethod invocable = getExceptionHandlerMethod(handlerMethod, exception); if (invocable == null) { logger.error("Unhandled exception from message handler method", exception); return; } invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); if (logger.isDebugEnabled()) { logger.debug("Invoking " + invocable.getShortLogMessage()); } try { Throwable cause = exception.getCause(); Object returnValue = (cause != null ? invocable.invoke(message, exception, cause, handlerMethod) : invocable.invoke(message, exception, handlerMethod)); MethodParameter returnType = invocable.getReturnType(); if (void.class == returnType.getParameterType()) { return; } this.returnValueHandlers.handleReturnValue(returnValue, returnType, message); } catch (Throwable ex2) { logger.error("Error while processing handler method exception", ex2); } }
private StreamListenerMessageHandler buildStreamListener(Class<?> handlerClass, String handlerMethodName, Class<?>... parameters) throws Exception { String channelName = "reply_" + System.nanoTime(); GenericApplicationContext context = new GenericApplicationContext(); context.getBeanFactory().registerSingleton(channelName, new QueueChannel()); Method m = ReflectionUtils.findMethod(handlerClass, handlerMethodName, parameters); InvocableHandlerMethod method = new InvocableHandlerMethod(this, m); HandlerMethodArgumentResolverComposite resolver = new HandlerMethodArgumentResolverComposite(); CompositeMessageConverterFactory factory = new CompositeMessageConverterFactory(); resolver.addResolver(new PayloadArgumentResolver( factory.getMessageConverterForAllRegistered())); method.setMessageMethodArgumentResolvers(resolver); Constructor<?> c = ReflectionUtils.accessibleConstructor( StreamListenerMessageHandler.class, InvocableHandlerMethod.class, boolean.class, String[].class); StreamListenerMessageHandler handler = (StreamListenerMessageHandler) c .newInstance(method, false, new String[] { }); handler.setOutputChannelName(channelName); handler.setBeanFactory(context); handler.afterPropertiesSet(); context.refresh(); return handler; }
invocable.setLogger(this.handlerMethodLogger); invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); try { Object returnValue = invocable.invoke(message);
invocable.setLogger(this.handlerMethodLogger); invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); try { Object returnValue = invocable.invoke(message);