camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bulutoprak <>
Subject Camel netty response is trimied for large data
Date Mon, 17 Feb 2014 08:35:33 GMT
I am using netty tcp route to handle requests and return a string message to
the clients. The solution is working for most of the case, but recently we
noticed that if the returned string is a large string (>2milyon characters)
, client socket can read only part of it. On the client, the code is like

// Client socket (pure java client socket getting response part
// First part is header part which identifies the length of the remaining
numread =, 0,10);

// We get the msgLenvariable from the header

	readBuff = new char[msgLen];
	readIndex = 0;
	while (readIndex < msgLen) {
*                // First read operation reads 262780 characters always and
second read blocks the socket.*
		numread =, readIndex, msgLen - readIndex);
		readIndex += numread;
	msgStr = new String(readBuff, 0, readIndex);

//Server side  uses StringEncoder to add the header part 

protected Object encode(ChannelHandlerContext ctx, Channel channel, Object
msg) throws Exception {

String dataToSend= ....  //We get the data by appending the header 
return ChannelBuffers.copiedBuffer(dataToSend,charset);

Route url:

My question is , is there mechanism that limits the number of
characters/bytes to return to the client in netty. 

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message