use of com.rabbitmq.jms.client.message.RMQTextMessage in project rabbitmq-jms-client by rabbitmq.
the class RMQMessageProducerTest method preferMessagePropertyNoMessagePropertySpecified.
@Test
public void preferMessagePropertyNoMessagePropertySpecified() throws Exception {
StubRMQMessageProducer producer = new StubRMQMessageProducer(session, destination, false);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
producer.setPriority(9);
producer.setTimeToLive(1000L);
RMQTextMessage message = new RMQTextMessage();
producer.send(message);
assertEquals(DeliveryMode.NON_PERSISTENT, message.getJMSDeliveryMode());
assertEquals(9, message.getJMSPriority());
assertTrue(message.getJMSExpiration() > System.currentTimeMillis());
}
use of com.rabbitmq.jms.client.message.RMQTextMessage in project rabbitmq-jms-client by rabbitmq.
the class SelectedTopicMessageIdentifierIT method testSendAndReceiveTextMessagesWithSelectorsAndPeriodIdentifiers.
@Test
public void testSendAndReceiveTextMessagesWithSelectorsAndPeriodIdentifiers() throws Exception {
topicConn.start();
TopicSession topicSession = topicConn.createTopicSession(false, Session.DUPS_OK_ACKNOWLEDGE);
Topic topic = topicSession.createTopic(TOPIC_NAME);
TopicPublisher sender = topicSession.createPublisher(topic);
TopicSubscriber receiver1 = topicSession.createSubscriber(topic, "period.bool.prop", false);
TopicSubscriber receiver2 = topicSession.createSubscriber(topic, "not period.bool.prop", false);
sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
TextMessage message1 = topicSession.createTextMessage(MESSAGE1);
TextMessage message2 = topicSession.createTextMessage(MESSAGE2);
message1.setBooleanProperty("period.bool.prop", true);
message2.setBooleanProperty("period.bool.prop", false);
sender.send(message1);
sender.send(message2);
RMQTextMessage tmsg1 = (RMQTextMessage) receiver1.receive();
RMQTextMessage tmsg2 = (RMQTextMessage) receiver2.receive();
String t1 = tmsg1.getText();
String t2 = tmsg2.getText();
assertEquals(MESSAGE1, t1);
assertEquals(MESSAGE2, t2);
}
Aggregations