6 Replies Latest reply on Feb 23, 2009 2:24 AM by Hartmut Lang

    How to close client conduit to JMS broker

    Hartmut Lang Newbie

      I'll try again, even if my last posts did not receive any answers so far. Maybe this is not the right forum to ask.

       

      We have this problem in cxf 2.0.x-fuse with client-side conduit which are connected to the activeMQ.

      So far we could not find a way to shoutdown the conduit in a way that the connection to activeMQ is really closed. Of course if we end the application the connection gets close. But we want to do this during runtime of our application.

       

      Szenario:

      - client application creates CXF conduit over JMS -> a connection to activeMQ is established.

      - client decides that it no longer needs this conduit -> connection to activeMQ can not be closed

       

      Any ideas welcome.

       

      /Hartmut

        • 1. Re: How to close client conduit to JMS broker
          Ulhas Bhole Novice

          Can you please be specific on the FUSE SF version you are using?

          • 2. Re: How to close client conduit to JMS broker
            Hartmut Lang Newbie

            Yes of course. I know that something has changed somewhere between 2.0.6 and 2.0.9.

            But the problem is that we use both versions: 2.0.6.1-fuse and 2.0.9.2-fuse.

             

            /Hartmut

            • 3. Re: How to close client conduit to JMS broker
              Sean O'Callaghan Newbie

              Hi Hartmut,

               

              I'd like to try and reproduce your problem, do you have a small testcase or can provide me with some more specific info (code) on what you are doing that would help me to achieve this.

               

              thanks,

               

              Seán.

              • 4. Re: How to close client conduit to JMS broker
                Hartmut Lang Newbie

                Our code looks like this (for 2.0.9.1-fuse) when we try to shutdown a JMSConduit's connection to the JMS broker (ActiveMQ).

                But if i do this and i check the connections the activeMQ shows in the jConsole i can see that there still is a connection active (at least in activeMQ).

                And also this code isn't very nice (because of the cast to internals of CXF) and it does not work like this in 2.0.6-fuse version

                 

                            Client client = ClientProxy.getClient(myPort);

                            JMSConduit conduit = (JMSConduit) client.getConduit();

                            conduit.close();

                            JMSConfiguration jmsConfig = conduit.getJmsConfig();

                            SingleConnectionFactory cf = (SingleConnectionFactory)jmsConfig.getConnectionFactory();

                            cf.destroy();

                • 5. Re: How to close client conduit to JMS broker
                  Ulhas Bhole Novice
                  hartmut wrote:

                  And also this code isn't very nice (because of the cast to internals of CXF) and it does not work like this in 2.0.6-fuse version

                   

                              Client client = ClientProxy.getClient(myPort);

                              JMSConduit conduit = (JMSConduit) client.getConduit();

                              conduit.close();

                              JMSConfiguration jmsConfig = conduit.getJmsConfig();

                              SingleConnectionFactory cf = (SingleConnectionFactory)jmsConfig.getConnectionFactory();

                              cf.destroy();

                   

                  I had a  quick look at the code and don't see any other way to do this. Also the method getConnectionFactory() is meant for Tests only. One possible reason why you should not shutdown ConnectionFactory is establising a connection is comparitively costly. So should cache connection as much as possible. It will add a significant overhead.  Is there any particular reason or bug you are trying to workaround which requires this behaviour.

                   

                  This surely won't work in 2.0.6-fuse because it was based on old JMS transport which wasn't using Spring JMS template and ConnectionFactory wasn't exposed via configuration.

                  • 6. Re: How to close client conduit to JMS broker
                    Hartmut Lang Newbie

                    In our CXF-based solution we have a system that is devided into something like different domains. Each domain supports the same kind of web-Services (about 10 domains each providing about 20 web-services).

                    Now our clients (many of them) uses these web-services via JMS for a specific domain. But sometimes the clients have to switch from one domain to another.

                    So we want to shutdown all Client-connections to JMS and reopen new ones (different JMS-queues are used for every domain).

                    The cost establishing new connections are not so important for us. We are more concerned about the big number of connections the clients make to the JMS-Broker, which results in a lot of socket-connections and many threads in the JMS-Broker. So we want to shutdwon the no longer needed connections (without of course shuting down the clients themself).

                     

                    For me that looks like a missing feature. Or are we the only ones who want to do something like that?