Hi,
I'm trying to programmatically stop delivery of messages in MDB deployed on Jboss 4.0.2. The call to JMSContanerInvoker::stopDelivery() works with a delay. For ex: if there are 4 messages in the queue and I issue stopDelivery() after consuming the very first message, the MDB would still consume the second message and stop only then leaving remaining 2 messages in the queue.
I saw a similar behavior in Jboss's JMX Console, where in order to stop delivery immediately one has to first click 'Invoke' in stopDelivery() section then navigate back and click 'Apply Changes' in a 'List of MBean Attributes' section.
Your help in resolving '1 message delay' in a call to stopDelivery() would be greatly appreciated.
--
AN
Here's the test class:
import java.util.Hashtable; import java.util.List; import javax.management.ObjectInstance; import javax.management.ObjectName; import junit.framework.Assert; import org.apache.log4j.Logger; import org.jboss.jmx.adaptor.rmi.RMIAdaptor; public class JmxManagerForMdbTest extends AbstractTest { private static final Logger log = Logger.getLogger(QueueListenerTest.class); public void test() throws Exception{ RMIAdaptor server = (RMIAdaptor) super.initialContext.lookup("jmx/rmi/RMIAdaptor"); Hashtable<String, String> ht = new Hashtable<String, String>(); ht.put("binding", "message-driven-bean"); ht.put("jndiName", "queue.listener"); ht.put("plugin", "invoker"); ht.put("service", "EJB"); ObjectName name = new ObjectName("jboss.j2ee", ht); server.invoke(name, "stopDelivery", new Object[] {}, null); } @Override public List<? extends AbstractTest> getProcessQueueTests() { return null; } }