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

Nicolas Filotto edited comment on CAMEL-16628 at 3/18/22, 11:11 AM:
--------------------------------------------------------------------

[~davsclaus] I've met the same problem as camel-atomix with camel-cxf, where we 
have one Constants class shared with several endpoints.

In this particular case, I could split the class in two to do the job but it is 
too intrusive just to add some doc to headers. Moreover, migrating all the 
components that have headers is already a very long task so if we could avoid 
having to split classes and duplicating declaration, it could be helpful.

As compromise, in case we have several endpoints sharing the same constants 
class, to avoid splitting it, I propose to add a new annotation or a new 
element to the annotation Metadata to be able to filter the headers.

Something like:

 
{code:java}
@Metadata(description = "some description", javaType = "String", applicableFor 
= {"foo", "bar"})
public static final String SOME_HEADER = "someHeaderName";
{code}
In the example above, the header "SOME_HEADER" is only for endpoints whose 
scheme is "foo" or "bar".

Is-it an acceptable solution for you? If so, I will do it tomorrow

 


was (Author: essobedo):
[~davsclaus] I've met the same problem as camel-atomix with camel-cxf, where we 
have one Constants class shared with several endpoints.

In this particular case, I could split the class in two to do the job but it is 
too intrusive just to add some doc to headers. Moreover, migrating all the 
components that have headers is already a very long task so if we could avoid 
having to split classes and duplicating declaration, it could be helpful.

As compromise, in case we have several endpoints sharing the same constants 
class, to avoid splitting it, I propose to add a new annotation or a new 
element to the annotation Metadata to be able to filter the headers.

Something like:

 
{code:java}
@Metadata(description = "some description", javaType = "String", 
acceptedSchemes = {"foo", "bar"})
public static final String SOME_HEADER = "someHeaderName";
{code}
In the example above, the header "SOME_HEADER" is only for endpoints whose 
scheme is "foo" or "bar".

Is-it an acceptable solution for you? If so, I will do it tomorrow

 

> camel-core - SPI annotations for message headers
> ------------------------------------------------
>
>                 Key: CAMEL-16628
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16628
>             Project: Camel
>          Issue Type: New Feature
>          Components: build system, camel-core
>            Reporter: Claus Ibsen
>            Assignee: Nicolas Filotto
>            Priority: Major
>             Fix For: 3.16.0
>
>
> Like we have for endpoint options with @UriParam, we should have a new SPI 
> annotation to markup headers that consumer/producers support.
> This allows us to generate that information into the component json file for 
> tooling support, and also to generate this in the website documentation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to