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