什么是在Spring XML定义骆驼航线的优势和劣势? [英] What are the advantages and disadvantages of defining Camel routes in spring xml?

查看:275
本文介绍了什么是在Spring XML定义骆驼航线的优势和劣势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我试图更深入地Apache的骆驼。你也知道有以至少两种方式来描述的路由:在Java DSL和所述XML配置

Currently I try to get deeper into Apache Camel. As you know there are at least two ways to describe the routes: the Java DSL and the XML-configuration.

骆驼的开发者推荐使用Java DSL,因为即其具有的好处是更好集成到IDE中。另一个好处是,你可以丰富你自己的code中的Java的DSL,而无需编写复杂的阶级结构。如果XML的配置是采取这似乎是必要的。

The developers of Camel recommend to use the Java DSL because i.e. it has the benefit that it better integrates into the IDE. Another benefit is, that you can enrich the Java DSL with your own code without writing complex class structures. This seems necessary if XML-configuration is taken.

你觉得是在一个XML文件中定义的优点和路线的缺点是什么?当使用XML的文件路径的定义以及何时使用Java DSL?

What do you think are the advantages and disadvantages of routes defined in an xml-file? When to use xml-files for definition of routes and when to use Java DSL?

推荐答案

这要看你的需求了一下,但在几乎所有情况下,我preFER了Java DSL,原因如下:

It depends on your requirements a bit, but in almost every case, I prefer the Java DSL for the following reasons:


  • 更有效,比XML灵活

  • XML / Java文件之间少翻转

  • 更容易显现,经营,维护,调试,的测试(通过模拟等)

  • 内联处理器支持

  • 与IDE(code完成和验证)更好地整合

  • 更清洁,更容易执行<一个href=\"https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/\">examples

  • more efficient and flexible than XML
  • less flipping between XML/Java files
  • easier to visualize, manage, maintain, debug, test (via mock, etc.)
  • support for inline Processors
  • better integration with IDE (code completion and validation)
  • cleaner, easier to follow examples

这篇关于什么是在Spring XML定义骆驼航线的优势和劣势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆