/** * Configure the handler with an {@link * org.springframework.integration.aggregator.MethodInvokingReleaseStrategy} for the target object * and method name. * * @param target the target object. * @param methodName the method name. * @return the handler spec. * @see AbstractCorrelatingMessageHandler#setReleaseStrategy(ReleaseStrategy) */ public S releaseStrategy(Object target, String methodName) { try { ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean(); releaseStrategyFactoryBean.setTarget(target); releaseStrategyFactoryBean.setMethodName(methodName); releaseStrategyFactoryBean.afterPropertiesSet(); return releaseStrategy(releaseStrategyFactoryBean.getObject()); } catch (Exception e) { throw new IllegalStateException(e); } }
/** * Configure the handler with {@link * org.springframework.integration.aggregator.MethodInvokingCorrelationStrategy} and {@link * org.springframework.integration.aggregator.MethodInvokingReleaseStrategy} using the target * object which should have methods annotated appropriately for each function. * * @param target the target object * @return the handler spec. * @see AbstractCorrelatingMessageHandler#setCorrelationStrategy(CorrelationStrategy) * @see AbstractCorrelatingMessageHandler#setReleaseStrategy(ReleaseStrategy) */ public S processor(Object target) { try { CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean(); correlationStrategyFactoryBean.setTarget(target); correlationStrategyFactoryBean.afterPropertiesSet(); ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean(); releaseStrategyFactoryBean.setTarget(target); releaseStrategyFactoryBean.afterPropertiesSet(); return correlationStrategy(correlationStrategyFactoryBean.getObject()) .releaseStrategy(releaseStrategyFactoryBean.getObject()); } catch (Exception e) { throw new IllegalStateException(e); } }