I would like to create a topic consumer module that I can re-use in my code. I am publishing stock quotes to a topic that I can consume no problem if I put my consumer logic all in once class. I would like to some how instantiate my ActiveMQConsumer class with a MessageListener so that the onMessage method is called where ever I want it (I hope that was clear?) For example
public class ActiveMQConsumer implements MessageListener { ... public void onMessage(Message m) { /* Works just find */ } } what I would like to do (and tried) is the following public class AnotherClass implements MessageListener { private static MessageListener ml; ... ActiveMQConsumer consumer = new ActiveMQConsumer(ml); ... public void OnMessage(Message msg) { }; } And i take the ml that I give to my ActiveMQConsumer class and when i set my message listener I use: c.setMessageListener(ml); // ml is give to class through constructor injection instead of c.setMessageListener(this); Everything compiles just fine and no exceptions are thrown, just nothing happens, I am thinking that it is a threading issue. Please help. -- View this message in context: http://old.nabble.com/inject-MessageListener-instance-to-allow-for-onMessage-to-reside-anywhere-in-the-application-tp27265456p27265456.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.