Hello,
I've posted here (not on user list) because I think that maybe this is a problem about jms implementation on ofbiz. We have a problem with ofbiz (3.0.0), JMS and network connection. We use JMS to invoke remote asynchronous services (and it works fine), but when the network connection goes down, there is a listener, AbstractJmsListener, that tries to refresh the connection every 10 seconds. It close the connection and then it load again. But the method close, once the connection has gone down, always generates an exception, so the load method is never called. I copy&paste the code from ofbiz: package org.ofbiz.service.jms; public abstract class AbstractJmsListener implements GenericMessageListener, ExceptionListener { .... /** * @see org.ofbiz.service.jms.GenericMessageListener#refresh() */ public void refresh() throws GenericServiceException { this.close(); <<<<---------- this.load(); } } but this method, called when there is an exception, when the network connection is broken, generates an exception "JMSException- Connection lost" on "this.close()" It really calls to org.ofbiz.service.jms.JmsTopicListener.close() (AbstractJmsTopicListener) { try { if (session != null) session.close(); <<<<---------- if (con != null) con.close(); } catch (JMSException e) { throw new GenericServiceException("Cannot close connection(s).", e); } } and session.close() (from org.exolab.jms.client.JmsTopicSession.close openJMS ) generates the exception. ------------------------- ------------------------- So I've changed the refresh code to catch the exception and always try to load. And then it works fine. When the connection goes down, every 10 seconds it try to refresh without luck, and when the connection comes back it close it (with exception) and then the load method is called, and the connection is restarted. public abstract class AbstractJmsListener implements GenericMessageListener, ExceptionListener { .... public void refresh() throws GenericServiceException { try { this.close(); }finally { this.load(); } } } So, this is a correct approach to keep up a JMS connection? do you know if there is any other way to keep JMS connection up without modifying ofbiz code? I've searched on SVN and the code is still the same that on 3.0.0 Thanks ! :-) -- * Ermengol * /*********************************************** * Els ordinadors no resolen problemes, * * simplement executen solucions. * ************************************************/ _______________________________________________ Dev mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/dev |
Yes, this is probably a very good idea. I will make the same changes
in the source tree. Thanks! Andy On Nov 25, 2005, at 5:11 AM, Ermengol Bota wrote: > Hello, > I've posted here (not on user list) because I think that maybe this is > a problem about jms implementation on ofbiz. > > We have a problem with ofbiz (3.0.0), JMS and network connection. > We use JMS to invoke remote asynchronous services (and it works fine), > but when the network connection goes down, there is a listener, > AbstractJmsListener, that tries to refresh the connection every 10 > seconds. It close the connection and then it load again. But the > method close, once the connection has gone down, always generates an > exception, so the load method is never called. > > I copy&paste the code from ofbiz: > > package org.ofbiz.service.jms; > public abstract class AbstractJmsListener implements > GenericMessageListener, ExceptionListener { > .... > /** > * @see org.ofbiz.service.jms.GenericMessageListener#refresh() > */ > public void refresh() throws GenericServiceException { > this.close(); <<<<---------- > this.load(); > } > } > > but this method, called when there is an exception, when the network > connection is broken, generates an exception "JMSException- Connection > lost" on "this.close()" > > It really calls to > org.ofbiz.service.jms.JmsTopicListener.close() > (AbstractJmsTopicListener) > { > try { > if (session != null) > session.close(); <<<<---------- > if (con != null) > con.close(); > } catch (JMSException e) { > throw new GenericServiceException("Cannot close > connection(s).", e); > } > } > > and session.close() (from org.exolab.jms.client.JmsTopicSession.close > openJMS ) generates the exception. > > ------------------------- > ------------------------- > > So I've changed the refresh code to catch the exception and always try > to load. And then it works fine. When the connection goes down, every > 10 seconds it try to refresh without luck, and when the connection > comes back it close it (with exception) and then the load method is > called, and the connection is restarted. > > public abstract class AbstractJmsListener implements > GenericMessageListener, ExceptionListener { > .... > public void refresh() throws GenericServiceException { > try { > this.close(); > }finally { > this.load(); > } > } > } > > > So, this is a correct approach to keep up a JMS connection? > > do you know if there is any other way to keep JMS connection up > without modifying ofbiz code? > > I've searched on SVN and the code is still the same that on 3.0.0 > > Thanks ! :-) > > -- > * Ermengol * > /*********************************************** > * Els ordinadors no resolen problemes, * > * simplement executen solucions. * > ************************************************/ > > _______________________________________________ > Dev mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/dev _______________________________________________ Dev mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/dev smime.p7s (3K) Download Attachment |
2005/11/28, A. Zeneski <[hidden email]>:
> Yes, this is probably a very good idea. I will make the same changes > in the source tree. Thanks! Ok , If you implements this in another way I will be glad to know about it. I'll be listening here and on SVN :-) -- * Ermengol * /*********************************************** * Els ordinadors no resolen problemes, * * simplement executen solucions. * ************************************************/ _______________________________________________ Dev mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/dev |
Free forum by Nabble | Edit this page |