You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Omar Al-Safi (Jira)" <ji...@apache.org> on 2020/05/06 08:37:00 UTC

[jira] [Comment Edited] (CAMEL-14634) documentation - Add page about endpoint-dsl and component-dsl to user guide

    [ https://issues.apache.org/jira/browse/CAMEL-14634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17100587#comment-17100587 ] 

Omar Al-Safi edited comment on CAMEL-14634 at 5/6/20, 8:36 AM:
---------------------------------------------------------------

Sure [~RimshaCh] !

Is basically very similar to the Endpoint DSL, but instead of constructing the endpoint through a DSL, you can construct a component through a DSL instead of initializing through a constructor. It allows you to resolve the placeholder when constructing the configurations as well as binding the component to the Camel context directly besides of course, the type saftey similar to the endpoint dsl.
 Example can be found [here|https://github.com/apache/camel-examples/blob/master/examples/camel-example-kafka/src/main/java/org/apache/camel/example/kafka/MessageConsumerClient.java#L48]. Referring to the example, it used to be done something like this which wasn't ideal after all:
{code:java}
KafkaComponent kafka = new KafkaComponent();
kafka.setBrokers("localhost:9090");

camelContext.addComponent("kafka", kafka);
{code}
These [list of generated DSLs for Camel Components|https://github.com/apache/camel/tree/master/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component.%20This%20is%20the%20public%20APIs%20https://github.com/apache/camel/blob/master/core/camel-componentdsl/src/main/java/org/apache/camel/builder/component/ComponentBuilder.java] uses in association with the generated DSL API in order to construct the component, you can skip {{doSetProperty}} as only used internally.

To use it, similar to the endpoint DSL, you need to include the following dependency:
{code:java}
 <dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-componentdsl</artifactId>
 <version>x.x.x</version>
 </dependency>
{code}
I hope this gives you a good background to work with it, also, I advice you to spend time to play around with it in order to grasp it. If you have any questions, please don't hesitate to ask! :).


was (Author: omarsmak):
Sure!

Is basically very similar to the Endpoint DSL, but instead of constructing the endpoint through a DSL, you can construct a component through a DSL instead of initializing through a constructor. It allows you to resolve the placeholder when constructing the configurations as well as binding the component to the Camel context directly besides of course, the type saftey similar to the endpoint dsl.
Example can be found [here|https://github.com/apache/camel-examples/blob/master/examples/camel-example-kafka/src/main/java/org/apache/camel/example/kafka/MessageConsumerClient.java#L48]. Referring to the example, it used to be done something like this which wasn't ideal after all:
{code}
KafkaComponent kafka = new KafkaComponent();
kafka.setBrokers("localhost:9090");

camelContext.addComponent("kafka", kafka);
{code}

These [list of generated DSLs for Camel Components|https://github.com/apache/camel/tree/master/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component. This is the public APIs https://github.com/apache/camel/blob/master/core/camel-componentdsl/src/main/java/org/apache/camel/builder/component/ComponentBuilder.java] uses in association with the generated DSL API in order to construct the component, you can skip {{doSetProperty}} as only used internally.

To use it, similar to the endpoint DSL, you need to include the following dependency:
{code}
 <dependency>
 <groupId>org.apache.camel</groupId>
 <artifactId>camel-componentdsl</artifactId>
 <version>x.x.x</version>
 </dependency>
{code}

I hope this gives you a good background to work with it, also, I advice you to spend time to play around with it in order to grasp it. If you have any questions, please don't hesitate to ask! :).

> documentation - Add page about endpoint-dsl and component-dsl to user guide
> ---------------------------------------------------------------------------
>
>                 Key: CAMEL-14634
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14634
>             Project: Camel
>          Issue Type: Improvement
>          Components: documentation, website
>            Reporter: Claus Ibsen
>            Priority: Major
>              Labels: help-wanted
>             Fix For: 3.3.0
>
>
> We need to document the cool new features of endpoint-dsl and component-dsl better. We should have a page for each of them, and added to the user guide
> [https://camel.apache.org/manual/latest/]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)