Spring Integration HttpServerErrorException$InternalServerError:500:超时内未收到回复

发布于 2025-01-19 07:04:19 字数 1238 浏览 4 评论 0 原文

我正在尝试使用窃听将一些数据复制到另一个通道。这是我的代码:

 @Bean
    public IntegrationFlow flow() {
     
            return IntegrationFlows.from(Http.inboundGateway("/foo")
                            .requestMapping(m -> m.methods(HttpMethod.POST)
                    .transform(Transformers.objectToString())
                    .enrichHeaders(h -> h.headerExpression())
                    .transform(new ObjectTransformation()).wireTap("subChannel")
                    .get();
    }

我也制作了一个订阅频道,也是一个loggerhandler

 @Bean
    public SubscribableChannel subscribeChannel() {
        return MessageChannels.publishSubscribe("subChannel")
                .get();
    }


    public LoggingHandler logger() {
        LoggingHandler logger = new LoggingHandler(Level.INFO);
        return logger;
    }

,我还创建了一个流程来记录复制数据:

 @Bean
    public IntegrationFlow subscribeFlow() {
        return IntegrationFlows.from("subChannel")
                .handle(logger()).get();
    }

我遇到了一个没有答复的错误:

org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 : "No reply received within timeout"

我不知道它是错误的,任何解决方案?

I am trying to copy some data to another channel using wireTap. this is my code:

 @Bean
    public IntegrationFlow flow() {
     
            return IntegrationFlows.from(Http.inboundGateway("/foo")
                            .requestMapping(m -> m.methods(HttpMethod.POST)
                    .transform(Transformers.objectToString())
                    .enrichHeaders(h -> h.headerExpression())
                    .transform(new ObjectTransformation()).wireTap("subChannel")
                    .get();
    }

I have made a subscribtion channel and a loggerHandler as well

 @Bean
    public SubscribableChannel subscribeChannel() {
        return MessageChannels.publishSubscribe("subChannel")
                .get();
    }


    public LoggingHandler logger() {
        LoggingHandler logger = new LoggingHandler(Level.INFO);
        return logger;
    }

I also created a flow to log the copied data :

 @Bean
    public IntegrationFlow subscribeFlow() {
        return IntegrationFlows.from("subChannel")
                .handle(logger()).get();
    }

I am getting an error that there is no reply :

org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 : "No reply received within timeout"

I don't know where it is going wrong, any solutions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

把昨日还给我 2025-01-26 07:04:19

解决方案
我在流程末端使用窃听()的事实使流程出错,因为默认情况没有回复。因此,我不得不将.bridge()添加到流中。
流应该如下:

@Bean
    public IntegrationFlow flow() {
     
            return IntegrationFlows.from(Http.inboundGateway("/foo")
                            .requestMapping(m -> m.methods(HttpMethod.POST)
                    .transform(Transformers.objectToString())
                    .enrichHeaders(h -> h.headerExpression())
                    .transform(new ObjectTransformation()).wireTap("subChannel").bridge()
                    .get();
    }

检查此帖子
https://stackoverflow.com/questions/62673629/timeout-timeout-on-replychannel-when-when-wiretap-is-used#:~: text= thex;

Solution
The fact that i am using the wireTap() at the end of the flow makes the flow goes wrong, because there is no reply on default. so i had to add .bridge() to the flow.
The flow should be as below :

@Bean
    public IntegrationFlow flow() {
     
            return IntegrationFlows.from(Http.inboundGateway("/foo")
                            .requestMapping(m -> m.methods(HttpMethod.POST)
                    .transform(Transformers.objectToString())
                    .enrichHeaders(h -> h.headerExpression())
                    .transform(new ObjectTransformation()).wireTap("subChannel").bridge()
                    .get();
    }

check this post
https://stackoverflow.com/questions/62673629/timeout-on-replychannel-when-wiretap-is-used#:~:text=The%20behavior%20is,more%20in%20docs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文