【问题标题】:Spring integration add route during runtimeSpring集成在运行时添加路由
【发布时间】:2019-12-31 10:28:37
【问题描述】:

是否可以在执行期间在 Spring Integration 中添加路由?我在 Spring Boot 中做项目,我需要使用 Spring Integration 使路由能够在运行时创建。我找不到合适的示例或文档来描述它是否可能以及如何实现。

【问题讨论】:

  • 请提供有关您要添加的路线的更多详细信息。请参阅此处的答案 - stackoverflow.com/a/23251125/3503019
  • 您的意思是要将传入请求动态路由到其他一些端点吗?

标签: java spring spring-integration


【解决方案1】:

你心目中的route是什么?你真的指的是路由器组件吗?那么为什么动态路由器不适合你:https://docs.spring.io/spring-integration/docs/5.2.2.RELEASE/reference/html/message-routing.html#dynamic-routers

因此,您可以在运行时使用AbstractMappingMessageRouter 填充路由器映射。

从某些版本开始,我们不再需要初始映射。

如果您谈到我们所说的流,那么您需要了解 Java DSL 及其动态流注册:https://docs.spring.io/spring-integration/docs/5.2.2.RELEASE/reference/html/dsl.html#java-dsl-runtime-flows

【讨论】:

    猜你喜欢
    • 2015-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    • 2018-06-15
    • 1970-01-01
    相关资源
    最近更新 更多