You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Gert Vanthienen <ge...@gmail.com> on 2009/11/10 11:43:45 UTC

Re: Can't send 2000 messages into the NMR : ESB is stuck after 1000...

L.S.,

It should not be necessary to create thread pool sizes this large to
keep the application running.  The most likely cause of your problems
is a message exchange pattern that's not getting handled properly so
exchanges remain pending inside the ESB.

In fact, I think the code snippet you sent us contains an example:
you're using send to send the InOnly exchange, but you never receive
the DONE exchange after the file has been saved by the file:sender
endpoint.  This will cause the seda queues to fill and eventually
stall the processing.

The way to solve this would be by adding a receive() after the send to
receive the DONE exchange or by using sendSync instead of send, that
way you'll remove the pending DONE exchanges from the queue.  Could
you give this a try?

If you would implement this code in a servicemix-bean pojo, you can
use the MessageListener interface to receive these DONE message
exchanges asynchronously.

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/11/9 jcamus <jc...@parkeon.com>:
>
> Hi!
> I am trying to send into the NMR 2000 messages in a row but ESB seems stuck
> after 1000 messages.
> My design is the following :
> CXF-BC -> CXF-SE -> FileSender
>
> So a SOAP Client is sending 2000 times the same request (in a simple loop,
> so no multithread) and in the CXF-SE here is method called :
>
> Here is the code :
>
> public void sendFile(String filename, byte[] fileContent, String deviceCode,
> int operatorCode) {
>        filename = operatorCode + "-" + deviceCode + "-" + filename;
>        try {
>            InOnly exchange  = getClient().createInOnlyExchange();
>            exchange.setService(m_incomingService);
>            ServiceEndpoint endPoint =
> getClient().getContext().getEndpoint(m_incomingService,
> m_incomingSenderEndpoint);
>            exchange.setEndpoint(endPoint);
>            NormalizedMessage messageToSend = exchange.getInMessage();
>            messageToSend.setProperty(DefaultFileMarshaler.FILE_NAME_PROPERTY,
> filename);
>            DataSource fileSource = new ByteDataSource(fileContent);
>            DataHandler handler = new DataHandler(fileSource);
>            messageToSend.addAttachment(DefaultFileMarshaler.FILE_CONTENT,
> handler);
>            getClient().send(exchange);
>        } catch (Exception e) {
>            m_gLogger.error("Error sendfile : filename " + filename + " deviceCode
> = " + deviceCode + " operatorCode = " + operatorCode, e);
>        }
>    }
>
>  private ServiceMixClient getClient() throws Exception {
>        if (m_client == null) {
>            ClientFactory factory = (ClientFactory) new
> InitialContext().lookup(ClientFactory.DEFAULT_JNDI_NAME);
>            m_client = factory.createClient();
>        }
>        return m_client;
>    }
>
>
>
> I tried to change the values into servicemix.conf like this (without
> success) :
>
> servicemix.corePoolSize    = 64
> servicemix.maximumPoolSize = 1280
> servicemix.queueSize       = 2560
>
> Can you explain me why the ESB freezes? When it happens I have to restart
> the ESB.. and all the messages pending are lost...
> Where am I wrong? Did I forget to free a resource?
>
> If  I replace the code above but a simple copyFile into the CXF-SE it works
> fine...
>
>
>
> --
> View this message in context: http://old.nabble.com/Can%27t-send-2000-messages-into-the-NMR-%3A-ESB-is-stuck-after-1000...-tp26269556p26269556.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: Can't send 2000 messages into the NMR : ESB is stuck after 1000...

Posted by jcamus <jc...@parkeon.com>.
Hi!
I try with the sendSync() method instead of send() and it works fine.
Thanks!
The code you saw is implemented into a cxf-se. So can it be done with a
MessageListener
like in a bean-se?

Regards.


Gert Vanthienen wrote:
> 
> L.S.,
> 
> It should not be necessary to create thread pool sizes this large to
> keep the application running.  The most likely cause of your problems
> is a message exchange pattern that's not getting handled properly so
> exchanges remain pending inside the ESB.
> 
> In fact, I think the code snippet you sent us contains an example:
> you're using send to send the InOnly exchange, but you never receive
> the DONE exchange after the file has been saved by the file:sender
> endpoint.  This will cause the seda queues to fill and eventually
> stall the processing.
> 
> The way to solve this would be by adding a receive() after the send to
> receive the DONE exchange or by using sendSync instead of send, that
> way you'll remove the pending DONE exchanges from the queue.  Could
> you give this a try?
> 
> If you would implement this code in a servicemix-bean pojo, you can
> use the MessageListener interface to receive these DONE message
> exchanges asynchronously.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/11/9 jcamus <jc...@parkeon.com>:
>>
>> Hi!
>> I am trying to send into the NMR 2000 messages in a row but ESB seems
>> stuck
>> after 1000 messages.
>> My design is the following :
>> CXF-BC -> CXF-SE -> FileSender
>>
>> So a SOAP Client is sending 2000 times the same request (in a simple
>> loop,
>> so no multithread) and in the CXF-SE here is method called :
>>
>> Here is the code :
>>
>> public void sendFile(String filename, byte[] fileContent, String
>> deviceCode,
>> int operatorCode) {
>>        filename = operatorCode + "-" + deviceCode + "-" + filename;
>>        try {
>>            InOnly exchange  = getClient().createInOnlyExchange();
>>            exchange.setService(m_incomingService);
>>            ServiceEndpoint endPoint =
>> getClient().getContext().getEndpoint(m_incomingService,
>> m_incomingSenderEndpoint);
>>            exchange.setEndpoint(endPoint);
>>            NormalizedMessage messageToSend = exchange.getInMessage();
>>          
>>  messageToSend.setProperty(DefaultFileMarshaler.FILE_NAME_PROPERTY,
>> filename);
>>            DataSource fileSource = new ByteDataSource(fileContent);
>>            DataHandler handler = new DataHandler(fileSource);
>>            messageToSend.addAttachment(DefaultFileMarshaler.FILE_CONTENT,
>> handler);
>>            getClient().send(exchange);
>>        } catch (Exception e) {
>>            m_gLogger.error("Error sendfile : filename " + filename + "
>> deviceCode
>> = " + deviceCode + " operatorCode = " + operatorCode, e);
>>        }
>>    }
>>
>>  private ServiceMixClient getClient() throws Exception {
>>        if (m_client == null) {
>>            ClientFactory factory = (ClientFactory) new
>> InitialContext().lookup(ClientFactory.DEFAULT_JNDI_NAME);
>>            m_client = factory.createClient();
>>        }
>>        return m_client;
>>    }
>>
>>
>>
>> I tried to change the values into servicemix.conf like this (without
>> success) :
>>
>> servicemix.corePoolSize    = 64
>> servicemix.maximumPoolSize = 1280
>> servicemix.queueSize       = 2560
>>
>> Can you explain me why the ESB freezes? When it happens I have to restart
>> the ESB.. and all the messages pending are lost...
>> Where am I wrong? Did I forget to free a resource?
>>
>> If  I replace the code above but a simple copyFile into the CXF-SE it
>> works
>> fine...
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Can%27t-send-2000-messages-into-the-NMR-%3A-ESB-is-stuck-after-1000...-tp26269556p26269556.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://old.nabble.com/Can%27t-send-2000-messages-into-the-NMR-%3A-ESB-is-stuck-after-1000...-tp26269556p26284524.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Can't send 2000 messages into the NMR : ESB is stuck after 1000...

Posted by jcamus <jc...@parkeon.com>.
Hi!
I try with the sendSync() method instead of send() and it works fine.
Thanks!
The code you saw is implemented into a cxf-se. So can it be done with a
MessageListener
like in a bean-se?

Regards.


Gert Vanthienen wrote:
> 
> L.S.,
> 
> It should not be necessary to create thread pool sizes this large to
> keep the application running.  The most likely cause of your problems
> is a message exchange pattern that's not getting handled properly so
> exchanges remain pending inside the ESB.
> 
> In fact, I think the code snippet you sent us contains an example:
> you're using send to send the InOnly exchange, but you never receive
> the DONE exchange after the file has been saved by the file:sender
> endpoint.  This will cause the seda queues to fill and eventually
> stall the processing.
> 
> The way to solve this would be by adding a receive() after the send to
> receive the DONE exchange or by using sendSync instead of send, that
> way you'll remove the pending DONE exchanges from the queue.  Could
> you give this a try?
> 
> If you would implement this code in a servicemix-bean pojo, you can
> use the MessageListener interface to receive these DONE message
> exchanges asynchronously.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/11/9 jcamus <jc...@parkeon.com>:
>>
>> Hi!
>> I am trying to send into the NMR 2000 messages in a row but ESB seems
>> stuck
>> after 1000 messages.
>> My design is the following :
>> CXF-BC -> CXF-SE -> FileSender
>>
>> So a SOAP Client is sending 2000 times the same request (in a simple
>> loop,
>> so no multithread) and in the CXF-SE here is method called :
>>
>> Here is the code :
>>
>> public void sendFile(String filename, byte[] fileContent, String
>> deviceCode,
>> int operatorCode) {
>>        filename = operatorCode + "-" + deviceCode + "-" + filename;
>>        try {
>>            InOnly exchange  = getClient().createInOnlyExchange();
>>            exchange.setService(m_incomingService);
>>            ServiceEndpoint endPoint =
>> getClient().getContext().getEndpoint(m_incomingService,
>> m_incomingSenderEndpoint);
>>            exchange.setEndpoint(endPoint);
>>            NormalizedMessage messageToSend = exchange.getInMessage();
>>          
>>  messageToSend.setProperty(DefaultFileMarshaler.FILE_NAME_PROPERTY,
>> filename);
>>            DataSource fileSource = new ByteDataSource(fileContent);
>>            DataHandler handler = new DataHandler(fileSource);
>>            messageToSend.addAttachment(DefaultFileMarshaler.FILE_CONTENT,
>> handler);
>>            getClient().send(exchange);
>>        } catch (Exception e) {
>>            m_gLogger.error("Error sendfile : filename " + filename + "
>> deviceCode
>> = " + deviceCode + " operatorCode = " + operatorCode, e);
>>        }
>>    }
>>
>>  private ServiceMixClient getClient() throws Exception {
>>        if (m_client == null) {
>>            ClientFactory factory = (ClientFactory) new
>> InitialContext().lookup(ClientFactory.DEFAULT_JNDI_NAME);
>>            m_client = factory.createClient();
>>        }
>>        return m_client;
>>    }
>>
>>
>>
>> I tried to change the values into servicemix.conf like this (without
>> success) :
>>
>> servicemix.corePoolSize    = 64
>> servicemix.maximumPoolSize = 1280
>> servicemix.queueSize       = 2560
>>
>> Can you explain me why the ESB freezes? When it happens I have to restart
>> the ESB.. and all the messages pending are lost...
>> Where am I wrong? Did I forget to free a resource?
>>
>> If  I replace the code above but a simple copyFile into the CXF-SE it
>> works
>> fine...
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Can%27t-send-2000-messages-into-the-NMR-%3A-ESB-is-stuck-after-1000...-tp26269556p26269556.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://old.nabble.com/Can%27t-send-2000-messages-into-the-NMR-%3A-ESB-is-stuck-after-1000...-tp26269556p26284524.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.