为什么 Spring 集成 Java JSON 的 DSL 请求不起作用

Why Spring Integration Java DSL request for the JSON is not working

我有 bean 定义

    @Bean
public IntegrationFlow inbound() {
    return IntegrationFlows.from(MessageChannels.queue("getSend1"))
            .handle(Http.outboundGateway("http://localhost:8055/greeting").httpMethod(HttpMethod.GET)
                    .expectedResponseType(String.class))
            .channel(MessageChannels.queue("getReceive1"))
            .get();
}

和默认轮询器,我想从 URL 获取 JSON。这是行不通的。根本没有调用服务 http://localhost:8055/greeting 并且日志消息

preReceive on channel 'getSend1'
postReceive on channel 'getSend1', message is null
Received no Message during the poll, returning 'false'

已打印。

它是这样工作的:

    @Bean
public IntegrationFlow inbound() {
    return IntegrationFlows
            .from(this.integerMessageSource(), c -> c.poller(Pollers.fixedRate(2000)))
            .handle(Http.outboundGateway("http://localhost:8055/greeting")
                    .httpMethod(HttpMethod.GET).expectedResponseType(String.class))
            .channel(MessageChannels.queue("getReceive"))
            .handle(Http.outboundGateway("http://localhost:8055/greeting").httpMethod(HttpMethod.POST)
                    .expectedResponseType(String.class))
            .channel(MessageChannels.queue("postReceive"))
            .handle(Http.outboundGateway("http://localhost:8055/greeting-final").httpMethod(HttpMethod.POST)
                    .expectedResponseType(String.class))
            .channel(MessageChannels.queue("postReceiveFinal"))
            .get();
}

这确实获得了第一个 URL,然后发布第二个 URL 的答案,然后发布第三个 URL 的答案并获得最终答案。