use of org.apache.activemq.artemis.api.core.client.ClientProducer in project wildfly by wildfly.
the class CoreQueueManagementTestCase method testListAndCountMessages.
@Test
public void testListAndCountMessages() throws Exception {
ClientProducer producer = session.createProducer(getQueueName());
producer.send(session.createMessage(ClientMessage.TEXT_TYPE, false));
producer.send(session.createMessage(ClientMessage.TEXT_TYPE, false));
ModelNode result = execute(getQueueOperation("list-messages"), true);
Assert.assertTrue(result.isDefined());
Assert.assertEquals(2, result.asList().size());
result = execute(getQueueOperation("count-messages"), true);
Assert.assertTrue(result.isDefined());
Assert.assertEquals(2, result.asInt());
}
use of org.apache.activemq.artemis.api.core.client.ClientProducer in project wildfly by wildfly.
the class ArtemisMessagingTestCase method sendMessage.
private void sendMessage(String text) throws Exception {
ClientProducer producer = session.createProducer(QUEUE_EXAMPLE_QUEUE);
ClientMessage message = session.createMessage(false);
message.putStringProperty(BODY, text);
log.trace("-----> Sending message");
producer.send(message);
}
Aggregations