Announcement Announcement Module
Collapse
No announcement yet.
Servlet destroy method call - what's recomended? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Servlet destroy method call - what's recomended?

    Hi,

    I'm very new in Spring-WS so I need help.
    I'm writing WS which should get the message and put it into WebSphere MQ queue. But MQ connection should be correctly closed during stopping WS so I need to call some cleaning stuff in servlet's destroy method.

    What is recommended way to do so?
    I guess I can derive class from org.springframework.ws.transport.http.MessageDispa tcherServlet and overload destroy method. Other possibility is to use Listener derived from ServletContextListener. I like this approach more but I have problem how to get MQSender bean I have defined in spring-ws-servlet.xml.

    I'm looking forward any suggestion.
    Thanks,
    Robert

  • #2
    read this
    http://static.springsource.org/sprin...rence/jms.html

    Let spring do it for you.

    Comment


    • #3
      Thank you for your suggestion but it didn't answer my questions. We have already implemented MQ related stuff using IBM WebSphere MQ API and we don't have time to change that using JMS. Maybe some example of using spring-ws and spring JMS together would help :-)

      Any other ideas?
      Thanks

      Comment


      • #4
        Since you are wanting to clean up the connections yourselves I am guessing you are creating them yourselves too and not using connection pooling through application server.

        If that is the case, one option would be to have DisposableBean do the clean up. Or specify destroy-method for the spring bean.


        In a standalone environment where the connection pooling is not there, you can use SingleConnectionFactory, where the connection can be used by JmsTemplate across multiple transactions.

        Comment


        • #5
          Looking for answer to the same question.
          Looks like DisposableBean is the way to go...
          Last edited by vdumitrescu; Sep 8th, 2009, 08:25 AM.

          Comment


          • #6
            Originally posted by portlet2 View Post
            Since you are wanting to clean up the connections yourselves I am guessing you are creating them yourselves too and not using connection pooling through application server.

            If that is the case, one option would be to have DisposableBean do the clean up. Or specify destroy-method for the spring bean.


            In a standalone environment where the connection pooling is not there, you can use SingleConnectionFactory, where the connection can be used by JmsTemplate across multiple transactions.
            Finally we created our own servlet derived from MessageDispatcherServlet and we implemented cleaning in its destroy method. Maybe not the nicest solution but it works :-)

            Regarding JMS. As I wrote we use WebSphere MQ directly (not via JMS) and we have implemented exclusive read from queue, reading message in browse mode first and only then (after successful processing) deleting from queue. I'm not sure if there is something like that already prepared in Spring or anywhere else. So that's the reason.

            Comment

            Working...
            X