Discussion:
Component options
ski n
2018-11-23 20:24:41 UTC
Permalink
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
2018-12-05 10:03:48 UTC
Permalink
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.
Post by ski n
1) Is it possible to get all options as a Map<String,String>
context.getComponent("componentName");
It also possible to get the Component documentation like
context.getComponentDocumentation("componentName");
catalog.componentHtmlDoc(componentType);
or use context.explainComponentJson(componentName, includeAllOptions)
However this returns documents (HTML/JSON). I would like to have a
context.getGlobalOptions()
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
HttpComponent http = context.getComponent("http4", HttpComponent.class);
http.setConnectionTimeToLive(5000);
context.setComponentOption("componentName","option","value");
Raymond
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Continue reading on narkive:
Loading...