MessageConsumer consumer = _session.createConsumer(topic);
// Use Management to move message.
ManagedQueue managedQueue = jmxUtils.
getManagedObject(ManagedQueue.class,
jmxUtils.getQueueObjectName(getConnectionFactory().getVirtualPath().substring(1),
getTestQueueName()));
// Find the first message on the queue
TabularData data = managedQueue.viewMessages(1L, 2L);
Iterator values = data.values().iterator();
assertTrue("No Messages found via JMX", values.hasNext());
// Get its message ID
Long msgID = (Long) ((CompositeDataSupport) values.next()).get("AMQ MessageId");
// Start the connection and consume message that has been moved to the
// queue
_connection.start();
Message message = consumer.receive(1000);
//Validate we don't have a message on the queue before we start
assertNull("Message should be null", message);
// Move it to from the topic to the queue
managedQueue.moveMessages(msgID, msgID, ((AMQTopic) topic).getQueueName());
// Retrieve the newly moved message
message = consumer.receive(1000);
assertNotNull("Message should not be null", message);