camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M.Ismail" <mohammed.h...@gmail.com>
Subject Re: Mina Buffer size
Date Wed, 26 Aug 2009 19:51:07 GMT

Hi, 
I've tried to make this workaround but I am not sure of it. Here is what I
came up with so far.

        MinaComponent inComponent = new MinaComponent();
	SocketConnectorConfig connectorConfig = new SocketConnectorConfig();
	

	TextLineDelimiter txtDelimiter   = TextLineDelimiter.AUTO;
	
	Charset charset = Charset.forName("ISO-8859-1");
	
	TextLineCodecFactory minaTxtCodecFactory = new
TextLineCodecFactory(charset,
Utility.getLineDelimiterParameter(txtDelimiter));
	((TextLineDecoder)minaTxtCodecFactory.getDecoder()).setMaxLineLength(5000);
	((TextLineEncoder)minaTxtCodecFactory.getEncoder()).setMaxLineLength(5000);
	
	
	MinaEndpoint minaEndPoint = new
MinaEndpoint("mina:tcp://172.21.5.99:9123?textline=true&sync=true",inComponent);
	
	connectorConfig.getFilterChain().addLast("codec", new
ProtocolCodecFilter(minaTxtCodecFactory));
	
	minaEndPoint.setConnectorConfig(connectorConfig);
	
	context.addComponent("mina", inComponent);
	context.addRoutes(new MyRouteBuilder()); 
	ProducerTemplate template = context.createProducerTemplate();
		
	
	context.start();

What do you think is missing? 



Claus Ibsen-2 wrote:
> 
> Hi
> 
> I found the option at:
> http://mina.apache.org/report/1.1/apidocs/org/apache/mina/filter/codec/textline/TextLineCodecFactory.html
> 
> We need to expose such option in camel URI so you can easily set it.
> Its default 1024 bytes.
> 
> I have created a ticket to track this:
> https://issues.apache.org/activemq/browse/CAMEL-1939
> 
> On Wed, Aug 26, 2009 at 8:08 AM, Claus Ibsen<claus.ibsen@gmail.com> wrote:
>> Hi
>>
>> Could you go ask at the MINA user forum and check the mina
>> documentation / google it.
>> And then come back with your findings. Then we can see if there is a
>> missing option needed in Camel.
>>
>> You can always use your own "protocol" and thus configure a TextLine
>> protocol that has a bigger buffer if that is possible with Mina.
>> But an option to set in the URI directly would be nice:
>>
>> eg:
>> textline=true&sync=true&buffer=8192
>>
>>
>>
>> On Tue, Aug 25, 2009 at 5:29 PM, M.Ismail<mohammed.hany@gmail.com> wrote:
>>>
>>> Hi,
>>> I'm trying to route messages from TCP to SOAP using this route:
>>> from("mina:tcp://172.xx.xx.xx:9123?textline=true&sync=true").process(new
>>> MyProcessor(true))
>>> .to("http://127.0.0.1:9001/SoapService");
>>> But I get an exception when I send an xml string with size 1994 bytes.
>>> Is
>>> there a way to increase the buffer to let's say 4KB? I'm using
>>> Camel-mina-1.6.1.0 and mina-core 1.1.7.
>>> Here is the Exception I get.
>>> org.apache.camel.component.mina.MinaConsumer$ReceiveHandler -
>>> [/172.xx.xx.xx:59269] Unexpected exception from exceptionCaught handler.
>>> org.apache.camel.CamelException:
>>> org.apache.mina.filter.codec.ProtocolDecoderException:
>>> org.apache.mina.common.BufferDataException: Line is too long: 1994
>>> (Hexdump:
>>> 4E 22 20 52 45 54 55 52 4E 3D 22 4E 4F 22 20 45 58 43 45 50 54 49 4F 4E
>>> 3D
>>> 22 4E 4F 22 3E 20 3C 49 54 45 4D 20 53 49 5A 45 3D 22 31 22 20 44 41 54
>>> 41
>>> 5F 54 59 50 45 3D 22 55 4E 4B 4E 4F 57 4E 22 20 56 41 4C 55 45 3D 22 32
>>> 36
>>> 34 38 35 34 34 34 30 31 31 35 22 20 2F 3E 20 20 20 3C 2F 50 41 52 41 4D
>>> 45
>>> 54 45 52 3E 20 3C 50 41 52 41 4D 45 54 45 52 20 44 49 52 45 43 54 49 4F
>>> 4E
>>> 3D 22 49 4E 22 20 4F 52 44 45 52 3D 22 34 22 20 4E 41 4D 45 3D 22 4D 4F
>>> 44
>>> 49 46 59 5F 4F 50 45 52 41 54 49 4F 4E 22 20 52 45 54 55 52 4E 3D 22 4E
>>> 4F
>>> 22 20 45 58 43 45 50 54 49 4F 4E 3D 22 4E 4F 22 3E 20 20 3C 49 54 45 4D
>>> 20
>>> 53 49 5A 45 3D 22 31 22 20 44 41 54 41 5F 54 59 50 45 3D 22 55 4E 4B 4E
>>> 4F
>>> 57 4E 22 20 56 41 4C 55 45 3D 22 53 75 70 70 6C 53 65 72 76 69 63 65 73
>>> 22
>>> 20 2F 3E 20 20 20 3C 2F 50 41 52 41 4D 45 54 45 52 3E 3C 50 41 52 41 4D
>>> 45
>>> 54 45 52 20 44 49 52 45 43 54 49 4F 4E 3D 22 49 4E 22 20 4F 52 44 45 52
>>> 3D
>>> 22 35 22 20 4E 41 4D 45 3D 22 43 66 75 22 20 52 45 54 55 52 4E 3D 22 4E
>>> 4F
>>> 22 20 45 58 43 45 50 54 49 4F 4E 3D 22 4E 4F 22 3E 20 3C 49 54 45 4D 3E
>>> 20
>>> 20 3C 41 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C
>>> 55
>>> 45 3D 22 62 73 67 22 20 4E 41 4D 45 3D 22 62 73 67 22 20 2F 3E 20 20 20
>>> 3C
>>> 41 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45
>>> 3D
>>> 22 66 74 6E 22 20 4E 41 4D 45 3D 22 66 74 6E 22 20 2F 3E 20 20 20 3C 41
>>> 54
>>> 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D 22
>>> 61
>>> 64 64 72 65 73 73 49 6E 64 69 63 61 74 6F 72 22 20 4E 41 4D 45 3D 22 61
>>> 64
>>> 64 72 65 73 73 49 6E 64 69 63 61 74 6F 72 22 20 2F 3E 20 20 20 3C 41 54
>>> 54
>>> 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D 22 73
>>> 74
>>> 61 74 75 73 22 20 4E 41 4D 45 3D 22 73 74 61 74 75 73 22 20 2F 3E 20 20
>>> 20
>>> 3C 41 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55
>>> 45
>>> 3D 22 32 22 20 4E 41 4D 45 3D 22 6E 6F 52 65 70 6C 79 54 69 6D 65 72 22
>>> 20
>>> 2F 3E 20 20 20 3C 41 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22
>>> 20
>>> 56 41 4C 55 45 3D 22 63 61 6C 6C 50 74 79 4E 6F 74 69 66 79 22 20 4E 41
>>> 4D
>>> 45 3D 22 63 61 6C 6C 50 74 79 4E 6F 74 69 66 79 22 20 2F 3E 20 20 20 3C
>>> 41
>>> 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D
>>> 22
>>> 66 77 64 50 74 79 4E 6F 74 69 66 79 22 20 4E 41 4D 45 3D 22 66 77 64 50
>>> 74
>>> 79 4E 6F 74 69 66 79 22 20 2F 3E 20 20 20 3C 41 54 54 52 49 42 55 54 45
>>> 20
>>> 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D 22 74 72 75 65 22 20 4E 41
>>> 4D
>>> 45 3D 22 66 6F 72 63 65 50 72 6F 76 22 20 2F 3E 20 20 20 3C 41 54 54 52
>>> 49
>>> 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D 22 61 64 64
>>> 22
>>> 20 4E 41 4D 45 3D 22 6F 70 65 72 61 74 69 6F 6E 54 79 70 65 22 20 2F 3E
>>> 20
>>> 20 20 3C 2F 49 54 45 4D 3E 20 20 20 3C 2F 50 41 52 41 4D 45 54 45 52 3E
>>> 20
>>> 3C 2F 50 41 52 41 4D 45 54 45 52 53 3E 20 20 20 3C 2F 4D 45 53 53 41 47
>>> 45
>>> 3E 20 20 20 3C 2F 49 4E 54 45 52 46 41 43 45 3E 20 20 20 3C 2F 45 58 54
>>> 45
>>> 52 4E 41 4C 5F 54 41 52 47 45 54 3E 20 3C 2F 41 50 49 3E 0A)
>>>        at
>>> org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.exceptionCaught(MinaConsumer.java:88)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.exceptionCaught(AbstractIoFilterChain.java:564)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.exceptionCaught(AbstractIoFilterChain.java:643)
>>>        at
>>> org.apache.mina.common.IoFilterAdapter.exceptionCaught(IoFilterAdapter.java:75)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.exceptionCaught(AbstractIoFilterChain.java:643)
>>>        at
>>> org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:224)
>>>        at
>>> org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
>>>        at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>>        at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>>        at
>>> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
>>>        at java.lang.Thread.run(Thread.java:595)
>>> Caused by: org.apache.mina.filter.codec.ProtocolDecoderException:
>>> org.apache.mina.common.BufferDataException: Line is too long: 1994
>>> (Hexdump:
>>> 4E 22 20 52 45 54 55 52 4E 3D 22 4E 4F 22 20 45 58 43 45 50 54 49 4F 4E
>>> 3D
>>> 22 4E 4F 22 3E 20 3C 49 54 45 4D 20 53 49 5A 45 3D 22 31 22 20 44 41 54
>>> 41
>>> 5F 54 59 50 45 3D 22 55 4E 4B 4E 4F 57 4E 22 20 56 41 4C 55 45 3D 22 32
>>> 36
>>> 34 38 35 34 34 34 30 31 31 35 22 20 2F 3E 20 20 20 3C 2F 50 41 52 41 4D
>>> 45
>>> 54 45 52 3E 20 3C 50 41 52 41 4D 45 54 45 52 20 44 49 52 45 43 54 49 4F
>>> 4E
>>> 3D 22 49 4E 22 20 4F 52 44 45 52 3D 22 34 22 20 4E 41 4D 45 3D 22 4D 4F
>>> 44
>>> 49 46 59 5F 4F 50 45 52 41 54 49 4F 4E 22 20 52 45 54 55 52 4E 3D 22 4E
>>> 4F
>>> 22 20 45 58 43 45 50 54 49 4F 4E 3D 22 4E 4F 22 3E 20 20 3C 49 54 45 4D
>>> 20
>>> 53 49 5A 45 3D 22 31 22 20 44 41 54 41 5F 54 59 50 45 3D 22 55 4E 4B 4E
>>> 4F
>>> 57 4E 22 20 56 41 4C 55 45 3D 22 53 75 70 70 6C 53 65 72 76 69 63 65 73
>>> 22
>>> 20 2F 3E 20 20 20 3C 2F 50 41 52 41 4D 45 54 45 52 3E 3C 50 41 52 41 4D
>>> 45
>>> 54 45 52 20 44 49 52 45 43 54 49 4F 4E 3D 22 49 4E 22 20 4F 52 44 45 52
>>> 3D
>>> 22 35 22 20 4E 41 4D 45 3D 22 43 66 75 22 20 52 45 54 55 52 4E 3D 22 4E
>>> 4F
>>> 22 20 45 58 43 45 50 54 49 4F 4E 3D 22 4E 4F 22 3E 20 3C 49 54 45 4D 3E
>>> 20
>>> 20 3C 41 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C
>>> 55
>>> 45 3D 22 62 73 67 22 20 4E 41 4D 45 3D 22 62 73 67 22 20 2F 3E 20 20 20
>>> 3C
>>> 41 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45
>>> 3D
>>> 22 66 74 6E 22 20 4E 41 4D 45 3D 22 66 74 6E 22 20 2F 3E 20 20 20 3C 41
>>> 54
>>> 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D 22
>>> 61
>>> 64 64 72 65 73 73 49 6E 64 69 63 61 74 6F 72 22 20 4E 41 4D 45 3D 22 61
>>> 64
>>> 64 72 65 73 73 49 6E 64 69 63 61 74 6F 72 22 20 2F 3E 20 20 20 3C 41 54
>>> 54
>>> 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D 22 73
>>> 74
>>> 61 74 75 73 22 20 4E 41 4D 45 3D 22 73 74 61 74 75 73 22 20 2F 3E 20 20
>>> 20
>>> 3C 41 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55
>>> 45
>>> 3D 22 32 22 20 4E 41 4D 45 3D 22 6E 6F 52 65 70 6C 79 54 69 6D 65 72 22
>>> 20
>>> 2F 3E 20 20 20 3C 41 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22
>>> 20
>>> 56 41 4C 55 45 3D 22 63 61 6C 6C 50 74 79 4E 6F 74 69 66 79 22 20 4E 41
>>> 4D
>>> 45 3D 22 63 61 6C 6C 50 74 79 4E 6F 74 69 66 79 22 20 2F 3E 20 20 20 3C
>>> 41
>>> 54 54 52 49 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D
>>> 22
>>> 66 77 64 50 74 79 4E 6F 74 69 66 79 22 20 4E 41 4D 45 3D 22 66 77 64 50
>>> 74
>>> 79 4E 6F 74 69 66 79 22 20 2F 3E 20 20 20 3C 41 54 54 52 49 42 55 54 45
>>> 20
>>> 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D 22 74 72 75 65 22 20 4E 41
>>> 4D
>>> 45 3D 22 66 6F 72 63 65 50 72 6F 76 22 20 2F 3E 20 20 20 3C 41 54 54 52
>>> 49
>>> 42 55 54 45 20 53 49 5A 45 3D 22 31 22 20 56 41 4C 55 45 3D 22 61 64 64
>>> 22
>>> 20 4E 41 4D 45 3D 22 6F 70 65 72 61 74 69 6F 6E 54 79 70 65 22 20 2F 3E
>>> 20
>>> 20 20 3C 2F 49 54 45 4D 3E 20 20 20 3C 2F 50 41 52 41 4D 45 54 45 52 3E
>>> 20
>>> 3C 2F 50 41 52 41 4D 45 54 45 52 53 3E 20 20 20 3C 2F 4D 45 53 53 41 47
>>> 45
>>> 3E 20 20 20 3C 2F 49 4E 54 45 52 46 41 43 45 3E 20 20 20 3C 2F 45 58 54
>>> 45
>>> 52 4E 41 4C 5F 54 41 52 47 45 54 3E 20 3C 2F 41 50 49 3E 0A)
>>>        at
>>> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:165)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
>>>        at
>>> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
>>>        at
>>> org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
>>>        ... 5 more
>>> Caused by: org.apache.mina.common.BufferDataException: Line is too long:
>>> 1994
>>>        at
>>> org.apache.mina.filter.codec.textline.TextLineDecoder.decodeAuto(TextLineDecoder.java:188)
>>>        at
>>> org.apache.mina.filter.codec.textline.TextLineDecoder.decode(TextLineDecoder.java:112)
>>>        at
>>> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:158)
>>>        ... 9 more
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Mina-Buffer-size-tp25136625p25136625.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://www.nabble.com/Mina-Buffer-size-tp25136625p25155992.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message