Results 1 to 3 of 3

Thread: Deploying MDPs in a standalone process

  1. #1
    Join Date
    Jan 2006
    Location
    Nashville, TN
    Posts
    34

    Default Deploying MDPs in a standalone process

    I was wondering if anyone had any pointers on how to make sure that all the MessageListenerContainers are stopped cleanly when the main method that created the ApplicationContext is stopped.

    During development I have used a very simple main method similar to the one used in this blog entry

    Code:
    public static void main(String[] args) throws IOException {
    
    new ClassPathXmlApplicationContext("/blog/mdp/server-context.xml"); System.in.read();
    }
    I am considering using the Java Service Wrapper to start and stop the process, but I need to make sure that the ApplicationContext is stopped correctly so that no components get interrupted in the middle of processing a message.

    Is there a better way to block? Do I need to register any shutdown hooks for closing the AppContext?

    Thanks,
    Caleb

  2. #2
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    You can explore the Spring JMS code and notice that all jms containers extend from AbstractJmsListeningContainer which, in turn, implements org.springframework.context.Lifecycle interface. So, if destroy() method is called, all JMS stuff is stopped. Hence, you only have to be sure that the method is called. For achieving this refer to application context documentation, registerShutdownHook() method in particular.

  3. #3
    Join Date
    Jan 2006
    Location
    Nashville, TN
    Posts
    34

    Default

    Thanks, Denis, that was helpful info.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •