You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2015/09/18 17:19:29 UTC

REST DSL Component, Consumer and Endpoint properties as Strings

Hi

I've noticed that when setting component, consumer, endpoint properties 
in REST DSL, once can only use String value (example, Map<String, 
String>), while in the related component/consumer/endpoint code there's 
an expectation that the values are Objects, Map<String, Object>.

Having String values can be a bit of a blocker when configuring a 
component, example, it is impossible to set up a CXF consumer with the 
custom provider instances.

I think it will be correct to relax a property type from String to 
Object in REST DSL but apparently properties are further wrapped into 
RestPropertyDefinition which is typed to have String values.

So it is impossible then to pass Non-String properties to a component 
behind a REST DSL route ? Or may be I'm missing something. Happy to do a 
patch but would like some clarifications first

Thanks, Sergey

Re: REST DSL Component, Consumer and Endpoint properties as Strings

Posted by Sergey Beryozkin <sb...@gmail.com>.
This is helpful, thanks

Cheers, Sergey
On 21/09/15 11:55, Claus Ibsen wrote:
> You can configure complex objects using the lookup notation using
> #nameOfBean. This is how you would configure Camel endpoints usually.
>
> The rest-dsl is for both java and xml and the syntax is for using
> values that are possible in both worlds.
>
> Its rest configuration is also for simpler and lighter configuration.
>
> If you want complex configuration you can configure the component as
> today with the java api the component offers. And then just refer to
> the component name.
>
> CxfComponent xxx = new CxfComponent();
> cxf.setBla ...
> cxf.setFoo ...
>
> context.addComponent("myCxf", xxx);
>
> And then refer to the component with the name myCxf.
>
>
>
>
> On Fri, Sep 18, 2015 at 5:19 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
>> Hi
>>
>> I've noticed that when setting component, consumer, endpoint properties in
>> REST DSL, once can only use String value (example, Map<String, String>),
>> while in the related component/consumer/endpoint code there's an expectation
>> that the values are Objects, Map<String, Object>.
>>
>> Having String values can be a bit of a blocker when configuring a component,
>> example, it is impossible to set up a CXF consumer with the custom provider
>> instances.
>>
>> I think it will be correct to relax a property type from String to Object in
>> REST DSL but apparently properties are further wrapped into
>> RestPropertyDefinition which is typed to have String values.
>>
>> So it is impossible then to pass Non-String properties to a component behind
>> a REST DSL route ? Or may be I'm missing something. Happy to do a patch but
>> would like some clarifications first
>>
>> Thanks, Sergey
>
>
>

Re: REST DSL Component, Consumer and Endpoint properties as Strings

Posted by Claus Ibsen <cl...@gmail.com>.
You can configure complex objects using the lookup notation using
#nameOfBean. This is how you would configure Camel endpoints usually.

The rest-dsl is for both java and xml and the syntax is for using
values that are possible in both worlds.

Its rest configuration is also for simpler and lighter configuration.

If you want complex configuration you can configure the component as
today with the java api the component offers. And then just refer to
the component name.

CxfComponent xxx = new CxfComponent();
cxf.setBla ...
cxf.setFoo ...

context.addComponent("myCxf", xxx);

And then refer to the component with the name myCxf.




On Fri, Sep 18, 2015 at 5:19 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
> Hi
>
> I've noticed that when setting component, consumer, endpoint properties in
> REST DSL, once can only use String value (example, Map<String, String>),
> while in the related component/consumer/endpoint code there's an expectation
> that the values are Objects, Map<String, Object>.
>
> Having String values can be a bit of a blocker when configuring a component,
> example, it is impossible to set up a CXF consumer with the custom provider
> instances.
>
> I think it will be correct to relax a property type from String to Object in
> REST DSL but apparently properties are further wrapped into
> RestPropertyDefinition which is typed to have String values.
>
> So it is impossible then to pass Non-String properties to a component behind
> a REST DSL route ? Or may be I'm missing something. Happy to do a patch but
> would like some clarifications first
>
> Thanks, Sergey



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition