codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Component options


No you can get the options of a component via its instance type, eg
HttpComponent has getter/setter for all its options.

To set default values on components you do as in (2) or if you use
spring-boot you can set them via SB auto configuration etc.

On Fri, Nov 23, 2018 at 9:24 PM ski n <raymondmeester@xxxxxxxxx> wrote:
>
> I have two questions regarding Component options:
>
> 1) Is it possible to get all options as a Map<String,String>
>
> From the context it's possible to get component:
>
> context.getComponent("componentName");
>
> It also possible to get the Component documentation like
>
>         context.getComponentDocumentation("componentName");
>
> or in later version from the catalog:
> catalog.componentHtmlDoc(componentType);
>
> or use context.explainComponentJson(componentName, includeAllOptions)
>
> However this returns documents  (HTML/JSON). I would like to have a
> Map<String,String> return like getting the globaloptions:
>
> context.getGlobalOptions()
>
> For example:
>
> context.getComponentOptions("componentName");
>
>
> 2) Is it possible to set another default?
>
> I like to change some of the defaults for components. I know I can do
> something like this:
>
> HttpComponent http = context.getComponent("http4", HttpComponent.class);
> http.setConnectionTimeToLive(5000);
>
> Is there also a more direct way. For example:
>
> context.setComponentOption("componentName","option","value");
>
> Raymond



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2