How to keep channel/socket open for netty client ?
Issue
- How to keep
socket
open ? - I am using
netty
component by customizing anetty
endpoint. I would like to send to a tcp server without closing the tcp channel after message dispatching.I configureNetty
endpoint like below
nettyConfiguration.setKeepAlive( true );
nettyConfiguration.setConnectTimeout( CONNECTIONTIMEOUT );
nettyConfiguration.setMaximumPoolSize( MAXPOOLSIZE) ;
nettyConfiguration.setOrderedThreadPoolExecutor( true );
nettyConfiguration.setDisconnect( false );
nettyConfiguration.setLazyChannelCreation( true );
nettyConfiguration.setRequestTimeout( REQUESTTIMEOUT );
nettyConfiguration.setTcpNoDelay( true );
nettyConfiguration.setDecoders( decoders );
nettyConfiguration.setProtocol( "tcp" );
nettyConfiguration.setHost( HOST );
nettyConfiguration.setPort( PORT );
nettyConfiguration.setSync( false );
nettyConfiguration.setNoReplyLogLevel( LoggingLevel.ERROR );
nettyConfiguration.setEncoders( encoders );
nettyConfiguration.setBroadcast( false );
nettyConfiguration.setSendBufferSize( 65536 );
nettyConfiguration.setReceiveBufferSize( 65536 );
nettyConfiguration.setReceiveBufferSizePredictor( 0 );
nettyConfiguration.setWorkerCount( 0 );
nettyConfiguration.setBossCount( 1 );
nettyConfiguration.setReuseAddress( true );
nettyConfiguration.setNeedClientAuth( false );
nettyConfiguration.setSsl( false );
nettyConfiguration.setSslClientCertHeaders( false );
nettyConfiguration.setDisconnectOnNoReply( false );
nettyConfiguration.setProducerPoolEnabled( true );
nettyConfiguration.setServerExceptionCaughtLogLevel( LoggingLevel.ERROR );
nettyConfiguration.setServerClosedChannelExceptionCaughtLogLevel( LoggingLevel.ERROR );
nettyConfiguration.setTextline( false );
nettyConfiguration.setAllowDefaultCodec( true );
// nettyConfiguration.setDelimiter( TextLineDelimiter.LINE );
// nettyConfiguration.setDecoderMaxLineLength( 1024 );
nettyConfiguration.setAutoAppendDelimiter( true );
nettyConfiguration.setProducerPoolMaxActive( -1 );
nettyConfiguration.setProducerPoolMinIdle( 0 );
nettyConfiguration.setProducerPoolMaxIdle( 1000 );
Environment
- Red Hat JBoss Fuse
- 6.2.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.