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

问题描述 投票:0回答:1

我有用于从数据库中轮询数据的集成流程。我设置了返回对象列表的消息源,这个列表我要传递给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而不是消息消息?

spring-integration spring-integration-dsl
1个回答
0
投票
.handle((p, h) -> personService.checkPerson(p))
© www.soinside.com 2019 - 2024. All rights reserved.