1.1. Implementing a RouteBuilder Class
来源:互联网 发布:海量数据存储方案 编辑:程序博客网 时间:2024/06/03 04:33
Overview
To use the Domain Specific Language (DSL), you extend the RouteBuilder class and override its configure() method (where you define your routing rules).
You can define as many RouteBuilder classes as necessary. Each class is instantiated once and is registered with the CamelContext object. Normally, the lifecycle of each RouteBuilder object is managed automatically by the container in which you deploy the router.
RouteBuilder classes
As a router developer, your core task is to implement one or more RouteBuilder classes. There are two alternative RouteBuilder classes that you can inherit from:
org.apache.camel.builder.RouteBuilder—this is the generic RouteBuilder base class that is suitable for deploying into any container type. It is provided in the camel-core artifact.org.apache.camel.spring.SpringRouteBuilder—this base class is specially adapted to the Spring container. In particular, it provides extra support for the following Spring specific features: looking up beans in the Spring registry (using the beanRef() Java DSL command) and transactions (see the Transactions Guide for details). It is provided in the camel-spring artifact.
The RouteBuilder class defines methods used to initiate your routing rules (for example, from(), intercept(), and exception()).
Implementing a RouteBuilder
Example 1.1, “Implementation of a RouteBuilder Class” shows a minimal RouteBuilder implementation. The configure() method body contains a routing rule; each rule is a single Java statement.
Example 1.1. Implementation of a RouteBuilder Class
import org.apache.camel.builder.RouteBuilder;public class MyRouteBuilder extends RouteBuilder {public void configure() { // Define routing rules here: from("file:src/data?noop=true").to("file:target/messages"); // More rules can be included, in you like. // ...}}
The form of the rule from(URL1).to(URL2) instructs the router to read files from the directory src/data and send them to the directory target/messages. The option ?noop=true instructs the router to retain (not delete) the source files in the src/data directory.
- 1.1. Implementing a RouteBuilder Class
- Implementing a dictionary using first class functions
- Implementing a Custom Component
- Implementing a Channel
- Implementing a Remote Interface
- Implementing a Custom Request
- 警告: Category is implementing a method which will also be implemented by its primary class
- category is implementing a method which will also be implemented bt its primary class
- iOS警告:Category is implementing a method which will also be implemented by its primary class
- java.lang.IncompatibleClassChangeError: Implementing class
- java.lang.IncompatibleClassChangeError:Implementing class
- java.lang.IncompatibleClassChangeError:Implementing class
- Implementing a Container View Controller
- Xcode警告Category is implementing a method which will also be implemented by its primary class 处理
- Xcode警告Category is implementing a method which will also be implemented by its primary class 处理
- 异常:Error: java.lang.IncompatibleClassChangeError: Implementing class
- 异常:java.lang.IncompatibleClassChangeError: Implementing class
- 异常:Error: java.lang.IncompatibleClassChangeError: Implementing class
- python学习之三
- eclipse怎么排除fckeditor报错问题? [问题点数:40分,结帖人CHNRosin]
- Intelij IDEA 常用快捷键
- pl/sql developer 查询语句无法使用中文条件
- L1-030. 一帮一
- 1.1. Implementing a RouteBuilder Class
- mysqldump导入导出数据库总结;MySQLDump在使用之前一定要想到的事情
- Calculate the expression
- 模拟ls -l命令简易代码demo
- Volley源码分析
- qq项目,,实现了加好友,,和单聊,,
- 在学习zookeeper时候遇见了log4j错误No appenders could be found for logger
- Centos 6 下配置nginx 反向代理Google
- Python实现简单网络爬虫--转自极客头条