1. Recall that in your first Camel ride (section 1.2.2), you read files from one directory (data/inbox) and wrote the results to another directory (data/outbox). Now that you know the core Camel concepts, you can put this example in perspective.

    回想一下,在Hello World(第1.2.2节)时,您从一个目录(data/inbox)读取文件,并将结果写入另一个目录(data/outbox)。现在您已经了解了Camel的核心概念,可以对这个示例进行透视。

    image.png

    In this example, you first create a CamelContext, which is the Camel runtime. You then add the routing logic using a RouteBuilder and the Java DSL @1. By using the DSL, you can cleanly and concisely let Camel instantiate components, endpoints, consumers, producers, and so on. All you have to focus on is defining the routes that matter for your integration projects. Under the hood, though, Camel is accessing the FileComponent, and using it as a factory to create the endpoint and its producer. The same FileComponent is used to create the consumer side as well.
    

    在本例中,首先创建一个CamelContext,即Camel运行时。然后使用RouteBuilder和java dsl @1添加路由逻辑。通过使用DSL,您可以简洁明了地让Camel实例化组件、端点、使用者、生产者等等。您所要关注的就是定义对您的集成项目至关重要的路线。不过,Camel在后台访问FileComponent,并将其用作工厂来创建端点及其生产者。同样的FileComponent也用于创建使用者端。