Question

I am new to Apache Camel. I can get lots of hints from the official site by tutorial. However, I still can not understand DSL. I know what file://~~~ or http:// means, but I cannot understand something like direct:a.

Are there any references to explain how many DSLs are and what each means?

Thank you for the help.

Was it helpful?

Solution 2

You said "I know what file://~~~ or http:// means, but I cannot understand something like direct:a."

file, http, and direct are all camel components which can be found in the link that hveiga already provided.

You also talk about DSLs, which SAM has given you some examples of.

I'm not sure if you are looking for the javadocs, they can be found here http://camel.apache.org/maven/current/camel-spring/apidocs/index.html

But they mostly just link back to camels web page. For the specific example of the "direct" component which you mentioned, all applicable arguments can be found here: http://camel.apache.org/maven/current/camel-core/apidocs/index.html

OTHER TIPS

Every Camel Component has a reference page with the explanation of what they do and what they are for. Also, there is usually a list with all the available options and few examples for that particular component.

You can see the full list of available components here: Apache Camel Components

In that list you will find the Direct component that you are looking for. In addition, depending of the language you are using few things change in the URIs. There are different DSLs for the different languages (Java, Spring XML, Scala, Java Annotations...). Information regarding differences is usually included the Component reference page. For more information about the different DSLs you should take a look here

Camel offers multiple DSL (domain specific language) such as Java, Scala, Groovy. The purpose of the DSL is to allow the developer to focus on the integration problem rather than on the tool—the programming language. Although Camel is written mostly in Java, it does support mixing multiple programming languages. Each language has its own strengths, and you may want to use different languages for different tasks. You have the freedom to build a solution your own way with as few constraints as possible.

Here are some examples of the DSL using different languages and staying functionally equivalent:

■ Java DSL

from("file:data/inbox").to("jms:queue:order");

■ Spring DSL

<route>
    <from uri="file:data/inbox"/>
    <to uri="jms:queue:order"/>
</route>

■ Scala DSL

from "file:data/inbox" -> "jms:queue:order"

These examples are real code, and they show how easily you can route files from a folder to a JMS queue using different DSL.

Although this question is a bit older, I stumbled upon it on my own search for a list of DSL keywords or method names I could use. As far as I could tell, most answers here try to explain, what DSL is but not where you can actually find a list of keywords. Daniel did give a reference to the Javadoc, but without further mentioning of the relevant classes.

After a longer search, I found the correct (and central) classes in the Documentation - specifically ProcssorDefinition, that is later extended by Route Definition. In thes classes, most of the keywords for the DSL are defined - together with a short explanation and the EIP they refer to.

Most interesting and relevant are the methods returning Type (in ProcessorDefinition) and RouteDefinition (in... well RouteDefinition), since they allow the kind of chaining you can see in DSL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top