【问题标题】:Camel to route external REST web serviceCamel 路由外部 REST Web 服务
【发布时间】:2018-02-06 22:48:01
【问题描述】:

我正在开发 Spring MVC 并使用 Apache camel 集成外部服务。 我想使用 Apache Camel 路由进行 Web 服务调用。

就像我的本地 REST 服务 (http://localhostsmiliex.xx:8080/users) 从外部 REST 服务 (http://xxx:000/users) 获取数据并希望通过路由来获取外部数据。

哪个 Apache 组件适合 Jetty 或生产者模板等 Web 服务路由?

【问题讨论】:

    标签: spring-mvc apache-camel


    【解决方案1】:

    使用 ProducerTemplate,它就像调用外部端点 REST、DB、SOAP 等的魅力。

    你可以自动装配它

    @Autowired
    ProducerTempalete prodcuerTemplate
    prodcuerTemplate.sendBody("http://xyz...", "<hello>world!</hello>"); 
    

    ProducerTemplate template = exchange.getContext().createProducerTemplate();
    
    // send to default endpoint
    template.sendBody("<hello>world!</hello>");
    
    // send to a specific queue
    template.sendBody("http://xyz...", "<hello>world!</hello>");
    

    【讨论】:

      【解决方案2】:

      您尝试过 HTTP4 或 HTTP 吗? http://camel.apache.org/http4.html

      【讨论】:

      • 谢谢gogic。如果我以这种方式路由.. from("direct:start").to("services.groupkt.com/country/get/all") 在我的应用程序路由器中不会触发 spring MVC 应用程序。
      猜你喜欢
      • 1970-01-01
      • 2015-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-25
      相关资源
      最近更新 更多