org.apache.camel.component.reactive.streams.engine.ReactiveStreamsEngineConfiguration Java Examples

The following examples show how to use org.apache.camel.component.reactive.streams.engine.ReactiveStreamsEngineConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReactiveStreamsRecorder.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public CamelReactiveStreamsService getReactiveStreamsService() {
    synchronized (this.lock) {
        if (getReactiveStreamsEngineConfiguration() == null) {
            ReactiveStreamsEngineConfiguration reactiveStreamsEngineConfiguration = new ReactiveStreamsEngineConfiguration();
            reactiveStreamsEngineConfiguration.setThreadPoolMaxSize(getThreadPoolMaxSize());
            reactiveStreamsEngineConfiguration.setThreadPoolMinSize(getThreadPoolMinSize());
            reactiveStreamsEngineConfiguration.setThreadPoolName(getThreadPoolName());
            setReactiveStreamsEngineConfiguration(reactiveStreamsEngineConfiguration);
        }
        if (reactiveStreamService == null) {
            this.reactiveStreamService = reactiveStreamServiceFactory.newInstance(
                    getCamelContext(),
                    getReactiveStreamsEngineConfiguration());

            try {
                // Start the service and add it to the Camel context to expose managed attributes
                getCamelContext().addService(this.reactiveStreamService, true, true);
            } catch (Exception e) {
                throw new RuntimeCamelException(e);
            }
        }
    }

    return this.reactiveStreamService;
}
 
Example #2
Source File: ReactiveStreamsServiceAutoConfiguration.java    From camel-spring-boot with Apache License 2.0 6 votes vote down vote up
@Lazy
@Bean
@ConditionalOnMissingBean
@ConditionalOnClass(CamelContext.class)
public CamelReactiveStreamsService camelReactiveStreamsService(ApplicationContext ac) throws Exception {
    ReactiveStreamsEngineConfiguration engineConfiguration = new ReactiveStreamsEngineConfiguration();

    if (configuration.getReactiveStreamsEngineConfiguration() != null) {
        engineConfiguration = ac.getBean(configuration.getReactiveStreamsEngineConfiguration(), ReactiveStreamsEngineConfiguration.class);
    } else {
        engineConfiguration.setThreadPoolName(configuration.getThreadPoolName());
        if (configuration.getThreadPoolMinSize() != null) {
            engineConfiguration.setThreadPoolMinSize(configuration.getThreadPoolMinSize());
        }
        if (configuration.getThreadPoolMaxSize() != null) {
            engineConfiguration.setThreadPoolMinSize(configuration.getThreadPoolMaxSize());
        }
    }

    return ReactiveStreamsHelper.resolveReactiveStreamsService(context, configuration.getServiceType(), engineConfiguration);
}
 
Example #3
Source File: CamelConnector.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
@PostConstruct
@Inject
public void init() {
    DefaultCamelReactiveStreamsServiceFactory factory = new DefaultCamelReactiveStreamsServiceFactory();
    ReactiveStreamsEngineConfiguration configuration = new ReactiveStreamsEngineConfiguration();

    Config config = ConfigProvider.getConfig();
    config.getOptionalValue("camel.component.reactive-streams.internal-engine-configuration.thread-pool-max-size",
            Integer.class).ifPresent(configuration::setThreadPoolMaxSize);
    config.getOptionalValue("camel.component.reactive-streams.internal-engine-configuration.thread-pool-min-size",
            Integer.class).ifPresent(configuration::setThreadPoolMinSize);
    config.getOptionalValue("camel.component.reactive-streams.internal-engine-configuration.thread-pool-name",
            String.class).ifPresent(configuration::setThreadPoolName);

    this.reactive = factory.newInstance(camel, configuration);
}