如何在集成流程中参数化对象?

时间:2019-03-27 16:44:32

标签: spring-integration spring-integration-dsl

我具有用于从数据库轮询数据的集成流程。我设置了消息源,该消息源返回对象列表,该列表我想传递给subFlow中的方法handle

这是实现此目标的代码,但出现编译错误:类型不兼容的消息到列表。

@Bean
    public IntegrationFlow integrationFlow(
            DataSource dataSource,
            MessageHandler amqpHandler,
            PersonService personService,
            PersonChecker personChecker) {
        return IntegrationFlows
                .from(getMessageSource(personService::getPersons), e -> e.poller(getPollerSpec()))
                .wireTap(subFlow -> subFlow.handle(personChecker::checkPerson))
                .split()
                .publishSubscribeChannel(pubSub -> pubSub
                        .subscribe(flow -> flow.bridge()
                                .transform(Transformers.toJson())
                                .handle(amqpHandler))
                        .subscribe(flow -> flow.bridge()
                                .handle(personService::markAsSent)))
                .get();
    }

我知道传递服务的解决方案和方法handle(personChecker, checkPerson)的名称,但这不适合我。

是否存在通过对象wireTap而不是消息消息在方法handle列表中的Person子流中传递消息的可能性?

1 个答案:

答案 0 :(得分:0)

.handle((p, h) -> personService.checkPerson(p))