标签: spring-integration-dsl

为 Http.outboundGateway 配置错误处理并重试 spring dsl

我有一个要求,当失败时我需要进行休息调用,我必须重试 3 次,并且根据收到的状态代码我需要执行不同的操作,我找不到合适的 spring 集成 dsl 示例。如何配置错误处理程序并重试

@Bean
public IntegrationFlow performCreate() {
    return IntegrationFlows.from("createFlow")
            .handle(Http.outboundGateway("http://localhost:8080/create")
                    .httpMethod(HttpMethod.GET)
                    .expectedResponseType(String.class)
                    .requestFactory(simpleClientHttpRequestFactory())
                    .errorHandler(??)
            )

            .log(LoggingHandler.Level.DEBUG, "response", m -> m.getPayload())
            .log(LoggingHandler.Level.DEBUG, "response", m -> m.getHeaders())
            .get();
}

private SimpleClientHttpRequestFactory simpleClientHttpRequestFactory() {
    SimpleClientHttpRequestFactory simpleClientHttpRequestFactory = new SimpleClientHttpRequestFactory();
    simpleClientHttpRequestFactory.setReadTimeout(5000);
    simpleClientHttpRequestFactory.setConnectTimeout(5000);
    return simpleClientHttpRequestFactory;
}
Run Code Online (Sandbox Code Playgroud)

spring-integration spring-integration-dsl

3
推荐指数
1
解决办法
1313
查看次数

Spring Integration Java DSL:如何使用channelMapping方法路由到标题中名称的通道?

如何使用channelMapping方法路由到标题中名称的通道?所以如果我尝试这个

    @Bean
    private IntegrationFlow postDataToChannelX() {
            return f -> f
            ...
               .<String, Boolean> route(s -> s.equals("[]"), m -> m
                    .channelMapping(false, "headers['channelName']")
                    .channleMapping(true, ...);
    }
Run Code Online (Sandbox Code Playgroud)

来了

引起:org.springframework.messaging.core.DestinationResolutionException:无法在 BeanFactory 中查找名称为“headers['channelName']”的 MessageChannel。;嵌套异常是 org.springframework.beans.factory.NoSuchBeanDefinitionException:没有名为 'headers['channelName']' 的 bean 可用

spring-integration spring-integration-dsl

3
推荐指数
1
解决办法
1045
查看次数

Spring Integration Java DSL错误

我使用最新的可用版本建立了一个新的Spring Boot + Spring Integration + Spring Integration Java DSL项目.项目构建正常但是,当我运行应用程序时,我得到:

Caused by: java.lang.NoSuchMethodError: org.springframework.integration.dsl.StandardIntegrationFlow.isRegisterComponents()Z
    at org.springframework.integration.dsl.config.IntegrationFlowBeanPostProcessor.processStandardIntegrationFlow(IntegrationFlowBeanPostProcessor.java:139) ~[spring-integration-java-dsl-1.2.3.RELEASE.jar:?]
    at org.springframework.integration.dsl.config.IntegrationFlowBeanPostProcessor.postProcessBeforeInitialization(IntegrationFlowBeanPostProcessor.java:100) ~[spring-integration-java-dsl-1.2.3.RELEASE.jar:?]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:423) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE]
Run Code Online (Sandbox Code Playgroud)

目前使用的依赖项如下:

compile ("org.springframework.boot:spring-boot-starter:2.0.0.RC1") {
    exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
}
compile "org.springframework.boot:spring-boot-starter-data-jpa:2.0.0.RC1"
compile "org.springframework.boot:spring-boot-starter-log4j2:2.0.0.RC1"
compile "org.springframework.integration:spring-integration-core:5.0.1.RELEASE"
compile "org.springframework.integration:spring-integration-http:5.0.1.RELEASE"
compile "org.springframework.integration:spring-integration-jms:5.0.1.RELEASE"
compile "org.springframework.integration:spring-integration-java-dsl:1.2.3.RELEASE"
Run Code Online (Sandbox Code Playgroud)

错误是由于jar版本的错误组合造成的吗?我不知道如何调试此错误.

spring-integration spring-boot spring-integration-dsl

2
推荐指数
1
解决办法
1816
查看次数

使用 Spring Integration DSL,如何配置不同集成之间的 I/O?

我有一个 Spring Boot 应用程序,我正在尝试将两个不同的 Spring Integration 服务连接在一起。我有一个 WebSocket 侦听器和一个使用这两个集成的可用 DSL 示例定义的 TCP 侦听器。

但是,我一直无法找到有关如何将它们连接在一起的文档。换句话说,当浏览器客户端打开 WebSocket 连接,并且从另一个系统接受传入的 TCP 连接时,我只想以双向能力盲目地将所有输入和输出从一个系统传递到另一个系统。将其视为两个协议之间的简单 telnet 桥,使用我的 Spring Boot 应用程序作为桥。

使用 Spring Integration DSL 似乎这种直接链接应该非常简单,但我什至找不到桥接多个连接的示例,即使使用注释接口也是如此。每当我从任一界面发送消息时,我都会看到“调度程序没有订阅者”错误。

我是否过于复杂化了,或者我需要编写一些业务逻辑代码来进行双向转发?

java spring-integration spring-boot spring-integration-dsl

2
推荐指数
1
解决办法
725
查看次数

fixedDelay() 和 fixedRate() 的区别

spring 集成Pollers.fixedDelay(5000)Pollers.fixedRate(5000)spring 集成有Pollers什么区别?

spring-integration poller spring-integration-dsl

1
推荐指数
1
解决办法
1080
查看次数