下面列出了javax.jms.Message#DEFAULT_DELIVERY_MODE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
protected void setUp() throws Exception {
super.setUp();
this.jmsMessageID = "ID:TEST-ID:0:0:0:1";
this.jmsCorrelationID = "testcorrelationid";
this.jmsDestination = new ActiveMQTopic("test.topic");
this.jmsReplyTo = new ActiveMQTempTopic("test.replyto.topic:001");
this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
this.jmsRedelivered = true;
this.jmsType = "test type";
this.jmsExpiration = 100000;
this.jmsPriority = 5;
this.jmsTimestamp = System.currentTimeMillis();
this.readOnlyMessage = false;
this.consumerIDs = new long[3];
for (int i = 0; i < this.consumerIDs.length; i++) {
this.consumerIDs[i] = i;
}
}
@Before
public void setUp() throws Exception {
this.jmsMessageID = "ID:TEST-ID:0:0:0:1";
this.jmsCorrelationID = "testcorrelationid";
this.jmsDestination = new JmsTopic("test.topic");
this.jmsReplyTo = new JmsTopic("test.replyto.topic:001");
this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
this.jmsRedelivered = true;
this.jmsType = "test type";
this.jmsExpiration = 100000;
this.jmsPriority = 5;
this.jmsTimestamp = System.currentTimeMillis();
this.consumerIDs = new long[3];
for (int i = 0; i < this.consumerIDs.length; i++) {
this.consumerIDs[i] = i;
}
}
public ProducerConfig()
{
_deliveryMode = Message.DEFAULT_DELIVERY_MODE;
_messageSize = 1024;
_priority = Message.DEFAULT_PRIORITY;
_timeToLive = Message.DEFAULT_TIME_TO_LIVE;
_interval = 0;
_messageProviderName = null;
}
public void testCopy() throws Exception {
this.jmsMessageID = "testid";
this.jmsCorrelationID = "testcorrelationid";
this.jmsDestination = new ActiveMQTopic("test.topic");
this.jmsReplyTo = new ActiveMQTempTopic("test.replyto.topic:001");
this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
this.jmsRedelivered = true;
this.jmsType = "test type";
this.jmsExpiration = 100000;
this.jmsPriority = 5;
this.jmsTimestamp = System.currentTimeMillis();
this.readOnlyMessage = false;
ActiveMQMessage msg1 = new ActiveMQMessage();
msg1.setJMSMessageID(this.jmsMessageID);
msg1.setJMSCorrelationID(this.jmsCorrelationID);
msg1.setJMSDestination(this.jmsDestination);
msg1.setJMSReplyTo(this.jmsReplyTo);
msg1.setJMSDeliveryMode(this.jmsDeliveryMode);
msg1.setJMSRedelivered(this.jmsRedelivered);
msg1.setJMSType(this.jmsType);
msg1.setJMSExpiration(this.jmsExpiration);
msg1.setJMSPriority(this.jmsPriority);
msg1.setJMSTimestamp(this.jmsTimestamp);
msg1.setReadOnlyProperties(true);
ActiveMQMessage msg2 = new ActiveMQMessage();
msg1.copy(msg2);
assertEquals(msg1.getJMSMessageID(), msg2.getJMSMessageID());
assertTrue(msg1.getJMSCorrelationID().equals(msg2.getJMSCorrelationID()));
assertTrue(msg1.getJMSDestination().equals(msg2.getJMSDestination()));
assertTrue(msg1.getJMSReplyTo().equals(msg2.getJMSReplyTo()));
assertTrue(msg1.getJMSDeliveryMode() == msg2.getJMSDeliveryMode());
assertTrue(msg1.getJMSRedelivered() == msg2.getJMSRedelivered());
assertTrue(msg1.getJMSType().equals(msg2.getJMSType()));
assertTrue(msg1.getJMSExpiration() == msg2.getJMSExpiration());
assertTrue(msg1.getJMSPriority() == msg2.getJMSPriority());
assertTrue(msg1.getJMSTimestamp() == msg2.getJMSTimestamp());
LOG.info("Message is: " + msg1);
}
@Test
public void testCopy() throws Exception {
this.jmsMessageID = "testid";
this.jmsCorrelationID = "testcorrelationid";
this.jmsDestination = new JmsTopic("test.topic");
this.jmsReplyTo = new JmsTopic("test.replyto.topic:001");
this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
this.jmsRedelivered = true;
this.jmsType = "test type";
this.jmsExpiration = 100000;
this.jmsPriority = 5;
this.jmsTimestamp = System.currentTimeMillis();
JmsConnection connection = Mockito.mock(JmsConnection.class);
JmsMessage msg1 = factory.createMessage();
msg1.setJMSMessageID(this.jmsMessageID);
msg1.setJMSCorrelationID(this.jmsCorrelationID);
msg1.setJMSDestination(this.jmsDestination);
msg1.setJMSReplyTo(this.jmsReplyTo);
msg1.setJMSDeliveryMode(this.jmsDeliveryMode);
msg1.setJMSRedelivered(this.jmsRedelivered);
msg1.setJMSType(this.jmsType);
msg1.setJMSExpiration(this.jmsExpiration);
msg1.setJMSPriority(this.jmsPriority);
msg1.setJMSTimestamp(this.jmsTimestamp);
msg1.setReadOnlyProperties(true);
msg1.setConnection(connection);
boolean isValidate = !msg1.isValidatePropertyNames();
msg1.setValidatePropertyNames(isValidate);
JmsMessage msg2 = msg1.copy();
assertEquals(msg1.getJMSMessageID(), msg2.getJMSMessageID());
assertTrue(msg2.isReadOnlyProperties());
assertTrue(msg1.getJMSCorrelationID().equals(msg2.getJMSCorrelationID()));
assertTrue(msg1.getJMSDestination().equals(msg2.getJMSDestination()));
assertTrue(msg1.getJMSReplyTo().equals(msg2.getJMSReplyTo()));
assertEquals(msg1.getJMSDeliveryMode(), msg2.getJMSDeliveryMode());
assertEquals(msg1.getJMSRedelivered(), msg2.getJMSRedelivered());
assertEquals(msg1.getJMSType(), msg2.getJMSType());
assertEquals(msg1.getJMSExpiration(), msg2.getJMSExpiration());
assertEquals(msg1.getJMSPriority(), msg2.getJMSPriority());
assertEquals(msg1.getJMSTimestamp(), msg2.getJMSTimestamp());
assertEquals(msg1.getConnection(), msg2.getConnection());
assertEquals(msg1.isValidatePropertyNames(), msg2.isValidatePropertyNames());
LOG.info("Message is: " + msg1);
}
/**
* Create a new instance with the default settings.
* @see Message#DEFAULT_DELIVERY_MODE
* @see Message#DEFAULT_PRIORITY
* @see Message#DEFAULT_TIME_TO_LIVE
*/
public QosSettings() {
this(Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
}
/**
* Create a new instance with the default settings.
* @see Message#DEFAULT_DELIVERY_MODE
* @see Message#DEFAULT_PRIORITY
* @see Message#DEFAULT_TIME_TO_LIVE
*/
public QosSettings() {
this(Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
}