Package org.apache.camel.component.netty
Interface NettyServerBootstrapFactory
- All Superinterfaces:
AutoCloseable
,org.apache.camel.Service
,org.apache.camel.SuspendableService
- All Known Implementing Classes:
ClientModeTCPNettyServerBootstrapFactory
,SingleTCPNettyServerBootstrapFactory
,SingleUDPNettyServerBootstrapFactory
public interface NettyServerBootstrapFactory
extends org.apache.camel.SuspendableService
Factory for setting up Netty
ServerBootstrap
and all the needed logic for doing that.
This factory allows for consumers to reuse existing ServerBootstrap
which allows to share
the same port for multiple consumers.-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChannel
(io.netty.channel.Channel channel) When a newChannel
is opened.void
addConsumer
(NettyConsumer consumer) When aNettyConsumer
is added and uses this bootstrap factory.void
init
(ThreadFactory threadFactory, NettyServerBootstrapConfiguration configuration, io.netty.channel.ChannelInitializer<io.netty.channel.Channel> pipelineFactory) Initializes this sharedNettyServerBootstrapFactory
.void
init
(org.apache.camel.CamelContext camelContext, NettyServerBootstrapConfiguration configuration, io.netty.channel.ChannelInitializer<io.netty.channel.Channel> pipelineFactory) Initializes this non-sharedNettyServerBootstrapFactory
.void
removeChannel
(io.netty.channel.Channel channel) When aChannel
is closed.void
removeConsumer
(NettyConsumer consumer) When aNettyConsumer
is removed and no longer using this bootstrap factory.Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Method Details
-
init
void init(org.apache.camel.CamelContext camelContext, NettyServerBootstrapConfiguration configuration, io.netty.channel.ChannelInitializer<io.netty.channel.Channel> pipelineFactory) Initializes this non-sharedNettyServerBootstrapFactory
.- Parameters:
camelContext
- theCamelContext
for non-shared bootstrap factoryconfiguration
- the bootstrap configurationpipelineFactory
- the channel initializer which set up the channel handler pipeline
-
init
void init(ThreadFactory threadFactory, NettyServerBootstrapConfiguration configuration, io.netty.channel.ChannelInitializer<io.netty.channel.Channel> pipelineFactory) Initializes this sharedNettyServerBootstrapFactory
.- Parameters:
threadFactory
- the thread factory to use for shared bootstrap factoryconfiguration
- the bootstrap configurationpipelineFactory
- the channel initializer which set up the channel handler pipeline
-
addChannel
void addChannel(io.netty.channel.Channel channel) When a newChannel
is opened. -
removeChannel
void removeChannel(io.netty.channel.Channel channel) When aChannel
is closed. -
addConsumer
When aNettyConsumer
is added and uses this bootstrap factory. -
removeConsumer
When aNettyConsumer
is removed and no longer using this bootstrap factory.
-