/** * Configure the handler with an {@link * org.springframework.integration.aggregator.MethodInvokingCorrelationStrategy} for the target * object and method name. * * @param target the target object. * @param methodName the method name. * @return the handler spec. * @see AbstractCorrelatingMessageHandler#setCorrelationStrategy(CorrelationStrategy) */ public S correlationStrategy(Object target, String methodName) { try { CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean(); correlationStrategyFactoryBean.setTarget(target); correlationStrategyFactoryBean.setMethodName(methodName); correlationStrategyFactoryBean.afterPropertiesSet(); return correlationStrategy(correlationStrategyFactoryBean.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); } }