I\'m developing a web application to be deployed onto Tomcat. When Tomcat is started, I use a servlet (in web.xml) to call a Java class:
<
You have to place the code with the loop in a different thread and start the thread from your consumer.
private void consume() { Thread x = new Thread(new Runnable() { @Override public void run() { while(true) { .... } }); x.start(); }