New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAMEL-13807: Add Component DSL fluent builders #3521
Conversation
@gnodet I have pushed a new commit with the following fixes:
Please take a look and let me know. |
This pull request introduces 1 alert when merging 928a744 into 7ad529d - view on LGTM.com new alerts:
|
There are a lot of changed files here, would it be possible to just post a snippet of how for example you can use this to configure Kafka, eg you mentioned the camel-kafka-example etc. |
Sure, here is an example:
Or from the unit tests:
Note: In order to resolve the placeholders, the camel context needs to be passed in the build method |
Ah thanks, yeah that looks lovely. For the placeholders then maybe we can have a ComponentsBuilderFactory instance you can dependency inject etc
Which will have CamelContext out of the box. But lets wait with this kind and get a first cut implemented first. Looks cool. And it has javadoc on the methods like the endpoint dsl ? |
Also there could be a method that registers the component to CamelContext with an optional name etc .register(camelContext, "mykafka"); |
Yes, it has everything generated, very similar to the endpointdsl.
|
@omarsmak , I'm not sure, but looks like you are missing just one thing, there are set of components (a few but important) which contains set of components inside. camel/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java Line 39 in f335870
but ComponentsBuilderFactory set only imap for camel-mail |
Ahh, thanks @dmvolod for the hints, I will take a look what we can do about. |
@davsclaus @dmvolod I have pushed a new commit that fixes the component aliases not being generated and adds a new
|
If there is no further comments, I would like to squash and merge this PR today |
Yeah I think it seems good, would really like to have this, and we can then improve on it. |
The componentdsl cannot compile - error in camel-hdfs. Also camel-jira needs a 3rd part repo (i may add that to the pom.xml). |
Also it may be that the generated code in the dsl is not sorted a..z either, eg so when others compile they may get a different order and the code is changed. eg make it sort so components that start with a in the top and so on. |
Okay with latest code and doing a full rebuild it seems the camel-hdfs issue is gone. |
Yeah that sort issue has to be addressed |
btw I wonder if we have a catch-22 situation. That the componentdsl, requires all components to be pre-build, eg what if you have a empty m2 repo and build from 100% scratch |
A full rebuild? I am curious about it, let me give a test :D |
This pull request introduces 1 alert when merging 908bfc1 into 42adfa6 - view on LGTM.com new alerts:
|
1 similar comment
This pull request introduces 1 alert when merging 908bfc1 into 42adfa6 - view on LGTM.com new alerts:
|
After merging this each time I rebuild (full rebuild) I'm getting these files modified
|
Yeah is because of the order. Pushing a fix for it now to have it ordered |
@oscerd @omarsmak @davsclaus I'm working on a fix to stabilize the generation while merging those changes in my local branch, I should push very soon. |
This PR implements components DSL according to CAMEL-13807. Few notes:
ComponentsBuilderFactory.kafka().setBrokers("{{host:port}}").build()
ComponentsBuilderFactory
interface, I used a metadata json file to keep track on the generated DSL classes and update whatever needed.ComponentsBuilderFactory.kafka().setBrokers("{{host:port}}").build(camelContext)
I have created an abstract class for both and helpers that can be shared in both. However, I left EndpointDslMojo untouched for now. Will remove some shared core once I am done from this PR.
Topics need to be done:
camel-componentDsl
.