use of org.apache.camel.component.reactive.streams.ReactiveStreamsComponent in project camel by apache.
the class ReactiveStreamsComponentAutoConfiguration method configureReactiveStreamsComponent.
@Lazy
@Bean(name = "reactive-streams-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ReactiveStreamsComponent.class)
public ReactiveStreamsComponent configureReactiveStreamsComponent(CamelContext camelContext, ReactiveStreamsComponentConfiguration configuration) throws Exception {
ReactiveStreamsComponent component = new ReactiveStreamsComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
IntrospectionSupport.getProperties(configuration, parameters, null, false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
if (paramClass.getName().endsWith("NestedConfiguration")) {
Class nestedClass = null;
try {
nestedClass = (Class) paramClass.getDeclaredField("CAMEL_NESTED_CLASS").get(null);
HashMap<String, Object> nestedParameters = new HashMap<>();
IntrospectionSupport.getProperties(value, nestedParameters, null, false);
Object nestedProperty = nestedClass.newInstance();
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), nestedProperty, nestedParameters);
entry.setValue(nestedProperty);
} catch (NoSuchFieldException e) {
}
}
}
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters);
return component;
}
use of org.apache.camel.component.reactive.streams.ReactiveStreamsComponent in project camel by apache.
the class CamelReactiveStreamsServiceImpl method start.
@Override
public void start() throws Exception {
ReactiveStreamsComponent component = context.getComponent("reactive-streams", ReactiveStreamsComponent.class);
ReactiveStreamsEngineConfiguration config = component.getInternalEngineConfiguration();
this.workerPool = context.getExecutorServiceManager().newThreadPool(this, config.getThreadPoolName(), config.getThreadPoolMinSize(), config.getThreadPoolMaxSize());
}
Aggregations