Search in sources :

Example 1 with DefaultEventLoopGroupConfiguration

use of io.micronaut.http.netty.channel.DefaultEventLoopGroupConfiguration in project micronaut-core by micronaut-projects.

the class DefaultNettyHttpClientRegistry method resolveSocketChannelFactory.

private ChannelFactory resolveSocketChannelFactory(HttpClientConfiguration configuration, BeanContext beanContext) {
    final String eventLoopGroup = configuration.getEventLoopGroup();
    final EventLoopGroupConfiguration eventLoopGroupConfiguration = beanContext.findBean(EventLoopGroupConfiguration.class, Qualifiers.byName(eventLoopGroup)).orElseGet(() -> {
        if (EventLoopGroupConfiguration.DEFAULT.equals(eventLoopGroup)) {
            return new DefaultEventLoopGroupConfiguration();
        } else {
            throw new HttpClientException("Specified event loop group is not defined: " + eventLoopGroup);
        }
    });
    return () -> eventLoopGroupFactory.clientSocketChannelInstance(eventLoopGroupConfiguration);
}
Also used : HttpClientException(io.micronaut.http.client.exceptions.HttpClientException) DefaultEventLoopGroupConfiguration(io.micronaut.http.netty.channel.DefaultEventLoopGroupConfiguration) EventLoopGroupConfiguration(io.micronaut.http.netty.channel.EventLoopGroupConfiguration) DefaultEventLoopGroupConfiguration(io.micronaut.http.netty.channel.DefaultEventLoopGroupConfiguration)

Aggregations

HttpClientException (io.micronaut.http.client.exceptions.HttpClientException)1 DefaultEventLoopGroupConfiguration (io.micronaut.http.netty.channel.DefaultEventLoopGroupConfiguration)1 EventLoopGroupConfiguration (io.micronaut.http.netty.channel.EventLoopGroupConfiguration)1