List of usage examples for javax.jms MessageProducer setDeliveryDelay
void setDeliveryDelay(long deliveryDelay) throws JMSException;
From source file:org.apache.activemq.artemis.tests.integration.persistence.metrics.JournalPendingMessageTest.java
@Test public void testScheduledStats() throws Exception { AtomicLong publishedMessageSize = new AtomicLong(); Connection connection = cf.createConnection(); connection.start();/* w w w .j a v a2 s . c o m*/ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(session.createQueue(defaultQueueName)); producer.setDeliveryDelay(2000); producer.send(session.createTextMessage("test")); verifyPendingStats(defaultQueueName, 1, publishedMessageSize.get()); verifyPendingDurableStats(defaultQueueName, 1, publishedMessageSize.get()); verifyScheduledStats(defaultQueueName, 1, publishedMessageSize.get()); consumeTestQueueMessages(1); verifyPendingStats(defaultQueueName, 0, 0); verifyPendingDurableStats(defaultQueueName, 0, 0); verifyScheduledStats(defaultQueueName, 0, 0); connection.close(); }