You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Johan Haleby <jo...@gmail.com> on 2010/02/09 09:47:56 UTC

Close Mina socket after each message

Hi,

I'm using Camel 2.1 with an Apache Mina endpoint configured like: 
inbound.endpoint=mina:tcp://localhost:6204?sync=false&textline=false

When many messages are sent to this endpoint I get the following exception:
org.apache.mina.common.RuntimeIOException: Failed to get the session.
   at
org.apache.mina.common.support.DefaultConnectFuture.getSession(DefaultConnectFuture.java:63)
   at
org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:175)
   at
org.apache.camel.component.mina.MinaProducer.process(MinaProducer.java:73)
   at
org.apache.camel.processor.MulticastProcessor.doProcess(MulticastProcessor.java:241)
   at
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:206)
   at
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:132)
   at
org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:87)
   at
org.apache.camel.processor.RecipientList.process(RecipientList.java:71)
   at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
   at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
   at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
   at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
   at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
   at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
   at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
   at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
   at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
   at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
   at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
   at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
   at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
   at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
   at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:85)
   at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.SocketException: Too many open files
   at sun.nio.ch.Net.socket0(Native Method)
   at sun.nio.ch.Net.socket(Net.java:94)
   at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:84)
   at
sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:37)
   at java.nio.channels.SocketChannel.open(SocketChannel.java:105)
   at
org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:168)
   at
org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137)
   at
org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:173)
   ... 24 more

I understand that this may happen because of too many open descriptors (in
my system it's 1024) but I would like to configure Mina to automatically
disconnect the socket when a message has been received. I never expect a
reply to these kinds of messages so what I'm looking for is kind of a "fire
and forget" approach. I thought setting the sync flag to false would
actually do this but I'm not sure anymore because I don't think I should get
this exception if that was the case. Any suggestions?

/Johan
-- 
View this message in context: http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512082.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Close Mina socket after each message

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Feb 9, 2010 at 12:32 PM, Johan Haleby <jo...@gmail.com> wrote:
>
> Wow that was fast. I assume that this fix will not make it into the 2.2
> release?

No 2.2 has already been cut.


>
> /Johan
>
>
> Claus Ibsen-2 wrote:
>>
>> On Tue, Feb 9, 2010 at 10:49 AM, Johan Haleby <jo...@gmail.com>
>> wrote:
>>>
>>> I've added issue  https://issues.apache.org/activemq/browse/CAMEL-2455
>>> CAMEL-2455 .
>>> Thanks for your help!
>>>
>>
>> Johan you are welcome to try out camel trunk as I have just commited
>> this new feature.
>>
>>
>>> /Johan
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> On Tue, Feb 9, 2010 at 10:24 AM, Johan Haleby <jo...@gmail.com>
>>>> wrote:
>>>>>
>>>>> I found one way to do this by setting the
>>>>> "CamelMinaCloseSessionWhenComplete"
>>>>> header to true in my route. How ever I would like the route to be as
>>>>> decoupled as possible from the actual endpoint component. Is there
>>>>> anyway
>>>>> to
>>>>> configure the "CamelMinaCloseSessionWhenComplete" in the session using
>>>>> the
>>>>> endpoint URI only?
>>>>>
>>>>
>>>> No could you create a JIRA ticket for this RFE.
>>>>
>>>>
>>>>> /Johan
>>>>>
>>>>>
>>>>> Johan Haleby wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm using Camel 2.1 with an Apache Mina endpoint configured like:
>>>>>> inbound.endpoint=mina:tcp://localhost:6204?sync=false&textline=false
>>>>>>
>>>>>> When many messages are sent to this endpoint I get the following
>>>>>> exception:
>>>>>> org.apache.mina.common.RuntimeIOException: Failed to get the session.
>>>>>>    at
>>>>>> org.apache.mina.common.support.DefaultConnectFuture.getSession(DefaultConnectFuture.java:63)
>>>>>>    at
>>>>>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:175)
>>>>>>    at
>>>>>> org.apache.camel.component.mina.MinaProducer.process(MinaProducer.java:73)
>>>>>>    at
>>>>>> org.apache.camel.processor.MulticastProcessor.doProcess(MulticastProcessor.java:241)
>>>>>>    at
>>>>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:206)
>>>>>>    at
>>>>>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:132)
>>>>>>    at
>>>>>> org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:87)
>>>>>>    at
>>>>>> org.apache.camel.processor.RecipientList.process(RecipientList.java:71)
>>>>>>    at
>>>>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>>>>    at
>>>>>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>>>>>    at
>>>>>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>>>>>    at
>>>>>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
>>>>>>    at
>>>>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>>>>    at
>>>>>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
>>>>>>    at
>>>>>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
>>>>>>    at
>>>>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
>>>>>>    at
>>>>>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>>>>>>    at
>>>>>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
>>>>>>    at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>>>>>>    at
>>>>>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>>>>>>    at
>>>>>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>>>>>    at
>>>>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>>>>    at
>>>>>> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:85)
>>>>>>    at
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>>>    at
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>>>>    at java.lang.Thread.run(Thread.java:619)
>>>>>> Caused by: java.net.SocketException: Too many open files
>>>>>>    at sun.nio.ch.Net.socket0(Native Method)
>>>>>>    at sun.nio.ch.Net.socket(Net.java:94)
>>>>>>    at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:84)
>>>>>>    at
>>>>>> sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:37)
>>>>>>    at java.nio.channels.SocketChannel.open(SocketChannel.java:105)
>>>>>>    at
>>>>>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:168)
>>>>>>    at
>>>>>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137)
>>>>>>    at
>>>>>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:173)
>>>>>>    ... 24 more
>>>>>>
>>>>>> I understand that this may happen because of too many open descriptors
>>>>>> (in
>>>>>> my system it's 1024) but I would like to configure Mina to
>>>>>> automatically
>>>>>> disconnect the socket when a message has been received. I never expect
>>>>>> a
>>>>>> reply to these kinds of messages so what I'm looking for is kind of a
>>>>>> "fire and forget" approach. I thought setting the sync flag to false
>>>>>> would
>>>>>> actually do this but I'm not sure anymore because I don't think I
>>>>>> should
>>>>>> get this exception if that was the case. Any suggestions?
>>>>>>
>>>>>> /Johan
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512471.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512763.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27513889.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Close Mina socket after each message

Posted by Johan Haleby <jo...@gmail.com>.
Wow that was fast. I assume that this fix will not make it into the 2.2
release?

/Johan


Claus Ibsen-2 wrote:
> 
> On Tue, Feb 9, 2010 at 10:49 AM, Johan Haleby <jo...@gmail.com>
> wrote:
>>
>> I've added issue  https://issues.apache.org/activemq/browse/CAMEL-2455
>> CAMEL-2455 .
>> Thanks for your help!
>>
> 
> Johan you are welcome to try out camel trunk as I have just commited
> this new feature.
> 
> 
>> /Johan
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Tue, Feb 9, 2010 at 10:24 AM, Johan Haleby <jo...@gmail.com>
>>> wrote:
>>>>
>>>> I found one way to do this by setting the
>>>> "CamelMinaCloseSessionWhenComplete"
>>>> header to true in my route. How ever I would like the route to be as
>>>> decoupled as possible from the actual endpoint component. Is there
>>>> anyway
>>>> to
>>>> configure the "CamelMinaCloseSessionWhenComplete" in the session using
>>>> the
>>>> endpoint URI only?
>>>>
>>>
>>> No could you create a JIRA ticket for this RFE.
>>>
>>>
>>>> /Johan
>>>>
>>>>
>>>> Johan Haleby wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm using Camel 2.1 with an Apache Mina endpoint configured like:
>>>>> inbound.endpoint=mina:tcp://localhost:6204?sync=false&textline=false
>>>>>
>>>>> When many messages are sent to this endpoint I get the following
>>>>> exception:
>>>>> org.apache.mina.common.RuntimeIOException: Failed to get the session.
>>>>>    at
>>>>> org.apache.mina.common.support.DefaultConnectFuture.getSession(DefaultConnectFuture.java:63)
>>>>>    at
>>>>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:175)
>>>>>    at
>>>>> org.apache.camel.component.mina.MinaProducer.process(MinaProducer.java:73)
>>>>>    at
>>>>> org.apache.camel.processor.MulticastProcessor.doProcess(MulticastProcessor.java:241)
>>>>>    at
>>>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:206)
>>>>>    at
>>>>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:132)
>>>>>    at
>>>>> org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:87)
>>>>>    at
>>>>> org.apache.camel.processor.RecipientList.process(RecipientList.java:71)
>>>>>    at
>>>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>>>    at
>>>>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>>>>    at
>>>>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>>>>    at
>>>>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
>>>>>    at
>>>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>>>    at
>>>>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
>>>>>    at
>>>>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
>>>>>    at
>>>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
>>>>>    at
>>>>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>>>>>    at
>>>>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
>>>>>    at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>>>>>    at
>>>>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>>>>>    at
>>>>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>>>>    at
>>>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>>>    at
>>>>> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:85)
>>>>>    at
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>>    at
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>>>    at java.lang.Thread.run(Thread.java:619)
>>>>> Caused by: java.net.SocketException: Too many open files
>>>>>    at sun.nio.ch.Net.socket0(Native Method)
>>>>>    at sun.nio.ch.Net.socket(Net.java:94)
>>>>>    at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:84)
>>>>>    at
>>>>> sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:37)
>>>>>    at java.nio.channels.SocketChannel.open(SocketChannel.java:105)
>>>>>    at
>>>>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:168)
>>>>>    at
>>>>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137)
>>>>>    at
>>>>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:173)
>>>>>    ... 24 more
>>>>>
>>>>> I understand that this may happen because of too many open descriptors
>>>>> (in
>>>>> my system it's 1024) but I would like to configure Mina to
>>>>> automatically
>>>>> disconnect the socket when a message has been received. I never expect
>>>>> a
>>>>> reply to these kinds of messages so what I'm looking for is kind of a
>>>>> "fire and forget" approach. I thought setting the sync flag to false
>>>>> would
>>>>> actually do this but I'm not sure anymore because I don't think I
>>>>> should
>>>>> get this exception if that was the case. Any suggestions?
>>>>>
>>>>> /Johan
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512471.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512763.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27513889.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Close Mina socket after each message

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Feb 9, 2010 at 10:49 AM, Johan Haleby <jo...@gmail.com> wrote:
>
> I've added issue  https://issues.apache.org/activemq/browse/CAMEL-2455
> CAMEL-2455 .
> Thanks for your help!
>

Johan you are welcome to try out camel trunk as I have just commited
this new feature.


> /Johan
>
>
> Claus Ibsen-2 wrote:
>>
>> On Tue, Feb 9, 2010 at 10:24 AM, Johan Haleby <jo...@gmail.com>
>> wrote:
>>>
>>> I found one way to do this by setting the
>>> "CamelMinaCloseSessionWhenComplete"
>>> header to true in my route. How ever I would like the route to be as
>>> decoupled as possible from the actual endpoint component. Is there anyway
>>> to
>>> configure the "CamelMinaCloseSessionWhenComplete" in the session using
>>> the
>>> endpoint URI only?
>>>
>>
>> No could you create a JIRA ticket for this RFE.
>>
>>
>>> /Johan
>>>
>>>
>>> Johan Haleby wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm using Camel 2.1 with an Apache Mina endpoint configured like:
>>>> inbound.endpoint=mina:tcp://localhost:6204?sync=false&textline=false
>>>>
>>>> When many messages are sent to this endpoint I get the following
>>>> exception:
>>>> org.apache.mina.common.RuntimeIOException: Failed to get the session.
>>>>    at
>>>> org.apache.mina.common.support.DefaultConnectFuture.getSession(DefaultConnectFuture.java:63)
>>>>    at
>>>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:175)
>>>>    at
>>>> org.apache.camel.component.mina.MinaProducer.process(MinaProducer.java:73)
>>>>    at
>>>> org.apache.camel.processor.MulticastProcessor.doProcess(MulticastProcessor.java:241)
>>>>    at
>>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:206)
>>>>    at
>>>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:132)
>>>>    at
>>>> org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:87)
>>>>    at
>>>> org.apache.camel.processor.RecipientList.process(RecipientList.java:71)
>>>>    at
>>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>>    at
>>>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>>>    at
>>>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>>>    at
>>>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
>>>>    at
>>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>>    at
>>>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
>>>>    at
>>>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
>>>>    at
>>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
>>>>    at
>>>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>>>>    at
>>>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
>>>>    at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>>>>    at
>>>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>>>>    at
>>>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>>>    at
>>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>>    at
>>>> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:85)
>>>>    at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>    at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>>    at java.lang.Thread.run(Thread.java:619)
>>>> Caused by: java.net.SocketException: Too many open files
>>>>    at sun.nio.ch.Net.socket0(Native Method)
>>>>    at sun.nio.ch.Net.socket(Net.java:94)
>>>>    at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:84)
>>>>    at
>>>> sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:37)
>>>>    at java.nio.channels.SocketChannel.open(SocketChannel.java:105)
>>>>    at
>>>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:168)
>>>>    at
>>>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137)
>>>>    at
>>>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:173)
>>>>    ... 24 more
>>>>
>>>> I understand that this may happen because of too many open descriptors
>>>> (in
>>>> my system it's 1024) but I would like to configure Mina to automatically
>>>> disconnect the socket when a message has been received. I never expect a
>>>> reply to these kinds of messages so what I'm looking for is kind of a
>>>> "fire and forget" approach. I thought setting the sync flag to false
>>>> would
>>>> actually do this but I'm not sure anymore because I don't think I should
>>>> get this exception if that was the case. Any suggestions?
>>>>
>>>> /Johan
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512471.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512763.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Close Mina socket after each message

Posted by Johan Haleby <jo...@gmail.com>.
I've added issue  https://issues.apache.org/activemq/browse/CAMEL-2455
CAMEL-2455 . 
Thanks for your help!

/Johan


Claus Ibsen-2 wrote:
> 
> On Tue, Feb 9, 2010 at 10:24 AM, Johan Haleby <jo...@gmail.com>
> wrote:
>>
>> I found one way to do this by setting the
>> "CamelMinaCloseSessionWhenComplete"
>> header to true in my route. How ever I would like the route to be as
>> decoupled as possible from the actual endpoint component. Is there anyway
>> to
>> configure the "CamelMinaCloseSessionWhenComplete" in the session using
>> the
>> endpoint URI only?
>>
> 
> No could you create a JIRA ticket for this RFE.
> 
> 
>> /Johan
>>
>>
>> Johan Haleby wrote:
>>>
>>> Hi,
>>>
>>> I'm using Camel 2.1 with an Apache Mina endpoint configured like:
>>> inbound.endpoint=mina:tcp://localhost:6204?sync=false&textline=false
>>>
>>> When many messages are sent to this endpoint I get the following
>>> exception:
>>> org.apache.mina.common.RuntimeIOException: Failed to get the session.
>>>    at
>>> org.apache.mina.common.support.DefaultConnectFuture.getSession(DefaultConnectFuture.java:63)
>>>    at
>>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:175)
>>>    at
>>> org.apache.camel.component.mina.MinaProducer.process(MinaProducer.java:73)
>>>    at
>>> org.apache.camel.processor.MulticastProcessor.doProcess(MulticastProcessor.java:241)
>>>    at
>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:206)
>>>    at
>>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:132)
>>>    at
>>> org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:87)
>>>    at
>>> org.apache.camel.processor.RecipientList.process(RecipientList.java:71)
>>>    at
>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>    at
>>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>>    at
>>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>>    at
>>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
>>>    at
>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>    at
>>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
>>>    at
>>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
>>>    at
>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
>>>    at
>>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>>>    at
>>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
>>>    at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>>>    at
>>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>>>    at
>>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>>    at
>>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>>    at
>>> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:85)
>>>    at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>    at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>    at java.lang.Thread.run(Thread.java:619)
>>> Caused by: java.net.SocketException: Too many open files
>>>    at sun.nio.ch.Net.socket0(Native Method)
>>>    at sun.nio.ch.Net.socket(Net.java:94)
>>>    at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:84)
>>>    at
>>> sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:37)
>>>    at java.nio.channels.SocketChannel.open(SocketChannel.java:105)
>>>    at
>>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:168)
>>>    at
>>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137)
>>>    at
>>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:173)
>>>    ... 24 more
>>>
>>> I understand that this may happen because of too many open descriptors
>>> (in
>>> my system it's 1024) but I would like to configure Mina to automatically
>>> disconnect the socket when a message has been received. I never expect a
>>> reply to these kinds of messages so what I'm looking for is kind of a
>>> "fire and forget" approach. I thought setting the sync flag to false
>>> would
>>> actually do this but I'm not sure anymore because I don't think I should
>>> get this exception if that was the case. Any suggestions?
>>>
>>> /Johan
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512471.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512763.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Close Mina socket after each message

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Feb 9, 2010 at 10:24 AM, Johan Haleby <jo...@gmail.com> wrote:
>
> I found one way to do this by setting the "CamelMinaCloseSessionWhenComplete"
> header to true in my route. How ever I would like the route to be as
> decoupled as possible from the actual endpoint component. Is there anyway to
> configure the "CamelMinaCloseSessionWhenComplete" in the session using the
> endpoint URI only?
>

No could you create a JIRA ticket for this RFE.


> /Johan
>
>
> Johan Haleby wrote:
>>
>> Hi,
>>
>> I'm using Camel 2.1 with an Apache Mina endpoint configured like:
>> inbound.endpoint=mina:tcp://localhost:6204?sync=false&textline=false
>>
>> When many messages are sent to this endpoint I get the following
>> exception:
>> org.apache.mina.common.RuntimeIOException: Failed to get the session.
>>    at
>> org.apache.mina.common.support.DefaultConnectFuture.getSession(DefaultConnectFuture.java:63)
>>    at
>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:175)
>>    at
>> org.apache.camel.component.mina.MinaProducer.process(MinaProducer.java:73)
>>    at
>> org.apache.camel.processor.MulticastProcessor.doProcess(MulticastProcessor.java:241)
>>    at
>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:206)
>>    at
>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:132)
>>    at
>> org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:87)
>>    at
>> org.apache.camel.processor.RecipientList.process(RecipientList.java:71)
>>    at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>    at
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>    at
>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>    at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
>>    at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>    at
>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
>>    at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
>>    at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
>>    at
>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>>    at
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
>>    at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>>    at
>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>>    at
>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>    at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>    at
>> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:85)
>>    at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>    at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>    at java.lang.Thread.run(Thread.java:619)
>> Caused by: java.net.SocketException: Too many open files
>>    at sun.nio.ch.Net.socket0(Native Method)
>>    at sun.nio.ch.Net.socket(Net.java:94)
>>    at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:84)
>>    at
>> sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:37)
>>    at java.nio.channels.SocketChannel.open(SocketChannel.java:105)
>>    at
>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:168)
>>    at
>> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137)
>>    at
>> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:173)
>>    ... 24 more
>>
>> I understand that this may happen because of too many open descriptors (in
>> my system it's 1024) but I would like to configure Mina to automatically
>> disconnect the socket when a message has been received. I never expect a
>> reply to these kinds of messages so what I'm looking for is kind of a
>> "fire and forget" approach. I thought setting the sync flag to false would
>> actually do this but I'm not sure anymore because I don't think I should
>> get this exception if that was the case. Any suggestions?
>>
>> /Johan
>>
>
> --
> View this message in context: http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512471.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Close Mina socket after each message

Posted by Johan Haleby <jo...@gmail.com>.
I found one way to do this by setting the "CamelMinaCloseSessionWhenComplete"
header to true in my route. How ever I would like the route to be as
decoupled as possible from the actual endpoint component. Is there anyway to
configure the "CamelMinaCloseSessionWhenComplete" in the session using the
endpoint URI only?

/Johan


Johan Haleby wrote:
> 
> Hi,
> 
> I'm using Camel 2.1 with an Apache Mina endpoint configured like: 
> inbound.endpoint=mina:tcp://localhost:6204?sync=false&textline=false
> 
> When many messages are sent to this endpoint I get the following
> exception:
> org.apache.mina.common.RuntimeIOException: Failed to get the session.
>    at
> org.apache.mina.common.support.DefaultConnectFuture.getSession(DefaultConnectFuture.java:63)
>    at
> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:175)
>    at
> org.apache.camel.component.mina.MinaProducer.process(MinaProducer.java:73)
>    at
> org.apache.camel.processor.MulticastProcessor.doProcess(MulticastProcessor.java:241)
>    at
> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:206)
>    at
> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:132)
>    at
> org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:87)
>    at
> org.apache.camel.processor.RecipientList.process(RecipientList.java:71)
>    at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>    at
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>    at
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>    at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
>    at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>    at
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
>    at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
>    at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
>    at
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>    at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
>    at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>    at
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>    at
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>    at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>    at
> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:85)
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>    at java.lang.Thread.run(Thread.java:619)
> Caused by: java.net.SocketException: Too many open files
>    at sun.nio.ch.Net.socket0(Native Method)
>    at sun.nio.ch.Net.socket(Net.java:94)
>    at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:84)
>    at
> sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:37)
>    at java.nio.channels.SocketChannel.open(SocketChannel.java:105)
>    at
> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:168)
>    at
> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137)
>    at
> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:173)
>    ... 24 more
> 
> I understand that this may happen because of too many open descriptors (in
> my system it's 1024) but I would like to configure Mina to automatically
> disconnect the socket when a message has been received. I never expect a
> reply to these kinds of messages so what I'm looking for is kind of a
> "fire and forget" approach. I thought setting the sync flag to false would
> actually do this but I'm not sure anymore because I don't think I should
> get this exception if that was the case. Any suggestions?
> 
> /Johan
> 

-- 
View this message in context: http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512471.html
Sent from the Camel - Users mailing list archive at Nabble.com.