Spring Integration DSL 如何异步发送消息到其他内部通道

Spring Integration DSL how to send messages asynchronously to other internal channels

现在我接受一个http请求来处理耗时的任务。所以我想先回复请求者,然后使用其他流异步处理它。

我尝试在 handler() 方法中使用 CompletableFuture.runAsync 然后使用 MessageChannel.send 来做。不过我觉得应该有更优雅的方式

 @Bean
    public IntegrationFlow testFlow(){
        return IntegrationFlows.from("requestChannel")//accept an request
                .handle(handlerSomeThing())//do something
                .handle()?// how to send message to main and reply quickly
                .enrichHeaders(c->c.header(HttpHeaders.STATUS_CODE,HttpStatus.OK))
                .get();
    }

 @Bean
    public IntegrationFlow mainFlow(){
        return IntegrationFlows.from("mainChannel")//accept an request
                .handleMainLogic()//handler main logic

                .get();
    }

用户a publishSubscribeChannel.

参见

添加任务执行器,使两个子流运行并行。