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

Luca Burgazzoli commented on CAMEL-14672:
-----------------------------------------

Thinking a little bit more about this, what we can do is something similar to 
the EventNotifier so

{code:java}
@FunctionalInterface
public interface ComponentCustomizer extends Consumer<Component>, Ordered {
    default boolean isEnabled(CamelComponent event) {
        return true;
    }
}
{code}

Then in addition to manually implement the interface, we can also expand the 
component dsl so once could write something like

{code:java}
@BindToRegistry
ComponentCustomizer customizeLog() {
    return ComponentsBuilderFactory.log(c -> c.setExchangeFormatter(...));
}
{code}

for XML, I don't think we need to add anything as in fact they are just beans 
so you'd only need to implement the interface and you are done


> Invoke ComponentCustomizer as part of component initialization
> --------------------------------------------------------------
>
>                 Key: CAMEL-14672
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14672
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>            Reporter: Luca Burgazzoli
>            Priority: Major
>             Fix For: 3.5.0
>
>
> Camel has the concept of _ComponentCustomizer_ which is currently used only 
> by spring-boot starters and I wonder if we can make it a generic concept so 
> basically after configuring the component with properties, we should search 
> for customizers in the camel registry and apply them to the component itself.
> Examples:
> -  
> https://github.com/apache/camel-spring-boot/blob/master/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/EhcacheComponentAutoConfiguration.java
> - 
> https://github.com/apache/camel-spring-boot/blob/master/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/EhcacheComponentAutoConfiguration.java



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

Reply via email to