javax.jms.Message.getJMSDeliveryMode()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中javax.jms.Message.getJMSDeliveryMode()方法的一些代码示例,展示了Message.getJMSDeliveryMode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getJMSDeliveryMode()方法的具体详情如下:
包路径:javax.jms.Message
类名称:Message
方法名:getJMSDeliveryMode

Message.getJMSDeliveryMode介绍

[英]Gets the DeliveryMode value specified for this message.
[中]获取为此邮件指定的DeliveryMode值。

代码示例

代码示例来源:origin: log4j/log4j

try {
sbuf.append("DeliveryMode=");
switch(m.getJMSDeliveryMode()) {
case DeliveryMode.NON_PERSISTENT :
 sbuf.append("NON_PERSISTENT");

代码示例来源:origin: spring-projects/spring-framework

int deliveryMode = jmsMessage.getJMSDeliveryMode();
headers.put(JmsHeaders.DELIVERY_MODE, deliveryMode);

代码示例来源:origin: apache/nifi

private Map<String, String> extractMessageHeaders(final Message message) throws JMSException {
  final Map<String, String> messageHeaders = new HashMap<>();
  messageHeaders.put(JmsHeaders.DELIVERY_MODE, String.valueOf(message.getJMSDeliveryMode()));
  messageHeaders.put(JmsHeaders.EXPIRATION, String.valueOf(message.getJMSExpiration()));
  messageHeaders.put(JmsHeaders.PRIORITY, String.valueOf(message.getJMSPriority()));
  messageHeaders.put(JmsHeaders.REDELIVERED, String.valueOf(message.getJMSRedelivered()));
  messageHeaders.put(JmsHeaders.TIMESTAMP, String.valueOf(message.getJMSTimestamp()));
  messageHeaders.put(JmsHeaders.CORRELATION_ID, message.getJMSCorrelationID());
  messageHeaders.put(JmsHeaders.MESSAGE_ID, message.getJMSMessageID());
  messageHeaders.put(JmsHeaders.TYPE, message.getJMSType());
  String replyToDestinationName = this.retrieveDestinationName(message.getJMSReplyTo(), JmsHeaders.REPLY_TO);
  if (replyToDestinationName != null) {
    messageHeaders.put(JmsHeaders.REPLY_TO, replyToDestinationName);
  }
  String destinationName = this.retrieveDestinationName(message.getJMSDestination(), JmsHeaders.DESTINATION);
  if (destinationName != null) {
    messageHeaders.put(JmsHeaders.DESTINATION, destinationName);
  }
  return messageHeaders;
}

代码示例来源:origin: apache/nifi

attributes.put(ATTRIBUTE_PREFIX + JMS_DELIVERY_MODE, String.valueOf(message.getJMSDeliveryMode()));
attributes.put(ATTRIBUTE_PREFIX + JMS_EXPIRATION, String.valueOf(message.getJMSExpiration()));
attributes.put(ATTRIBUTE_PREFIX + JMS_PRIORITY, String.valueOf(message.getJMSPriority()));

代码示例来源:origin: wildfly/wildfly

setJMSDeliveryMode(foreign.getJMSDeliveryMode());
setJMSExpiration(foreign.getJMSExpiration());
setJMSPriority(foreign.getJMSPriority());

代码示例来源:origin: apache/activemq

/**
   * Copies the standard JMS and user defined properties from the givem
   * message to the specified message
   *
   * @param fromMessage the message to take the properties from
   * @param toMessage the message to add the properties to
   * @throws JMSException
   */
  public static void copyProperties(Message fromMessage, Message toMessage) throws JMSException {
    toMessage.setJMSMessageID(fromMessage.getJMSMessageID());
    toMessage.setJMSCorrelationID(fromMessage.getJMSCorrelationID());
    toMessage.setJMSReplyTo(transformDestination(fromMessage.getJMSReplyTo()));
    toMessage.setJMSDestination(transformDestination(fromMessage.getJMSDestination()));
    toMessage.setJMSDeliveryMode(fromMessage.getJMSDeliveryMode());
    toMessage.setJMSRedelivered(fromMessage.getJMSRedelivered());
    toMessage.setJMSType(fromMessage.getJMSType());
    toMessage.setJMSExpiration(fromMessage.getJMSExpiration());
    toMessage.setJMSPriority(fromMessage.getJMSPriority());
    toMessage.setJMSTimestamp(fromMessage.getJMSTimestamp());

    Enumeration propertyNames = fromMessage.getPropertyNames();

    while (propertyNames.hasMoreElements()) {
      String name = propertyNames.nextElement().toString();
      Object obj = fromMessage.getObjectProperty(name);
      toMessage.setObjectProperty(name, obj);
    }
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void jmsReadOnlyPropertiesNotMapped() throws JMSException {
  Message<String> message = initBuilder()
      .setHeader(JmsHeaders.DESTINATION, new Destination() {})
      .setHeader(JmsHeaders.DELIVERY_MODE, DeliveryMode.NON_PERSISTENT)
      .setHeader(JmsHeaders.EXPIRATION, 1000L)
      .setHeader(JmsHeaders.MESSAGE_ID, "abc-123")
      .setHeader(JmsHeaders.PRIORITY, 9)
      .setHeader(JmsHeaders.REDELIVERED, true)
      .setHeader(JmsHeaders.TIMESTAMP, System.currentTimeMillis())
      .build();
  javax.jms.Message jmsMessage = new StubTextMessage();
  mapper.fromHeaders(message.getHeaders(), jmsMessage);
  assertNull(jmsMessage.getJMSDestination());
  assertEquals(DeliveryMode.PERSISTENT, jmsMessage.getJMSDeliveryMode());
  assertEquals(0, jmsMessage.getJMSExpiration());
  assertNull(jmsMessage.getJMSMessageID());
  assertEquals(javax.jms.Message.DEFAULT_PRIORITY, jmsMessage.getJMSPriority());
  assertFalse(jmsMessage.getJMSRedelivered());
  assertEquals(0, jmsMessage.getJMSTimestamp());
}

代码示例来源:origin: apache/log4j

try {
sbuf.append("DeliveryMode=");
switch(m.getJMSDeliveryMode()) {
case DeliveryMode.NON_PERSISTENT :
 sbuf.append("NON_PERSISTENT");

代码示例来源:origin: spring-projects/spring-integration

headers.put(JmsHeaders.DELIVERY_MODE, jmsMessage.getJMSDeliveryMode());

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public int getJMSDeliveryMode() throws JMSException {
  return message.getJMSDeliveryMode();
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

public int getJMSDeliveryMode() throws JMSException
{
 return message.getJMSDeliveryMode();
}

代码示例来源:origin: org.apache.qpid/qpid-jca

/**
* Get delivery mode
* @return The value
* @exception JMSException Thrown if an error occurs
*/
public int getJMSDeliveryMode() throws JMSException
{
 if (_log.isTraceEnabled())
 {
   _log.trace("getJMSDeliveryMode()");
 }
 return _message.getJMSDeliveryMode();
}

代码示例来源:origin: org.apache.activemq/artemis-ra

/**
* Get delivery mode
*
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public int getJMSDeliveryMode() throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("getJMSDeliveryMode()");
 }
 return message.getJMSDeliveryMode();
}

代码示例来源:origin: apache/activemq-artemis

/**
* Get delivery mode
*
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public int getJMSDeliveryMode() throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("getJMSDeliveryMode()");
 }
 return message.getJMSDeliveryMode();
}

代码示例来源:origin: org.apache.servicemix/servicemix-jms

/**
 * Override so we can support preserving the Qos settings that have
 * been set on the message.
 */
protected void doSend(MessageProducer producer, Message message) throws JMSException {
  if (isPreserveMessageQos()) {
    producer.send(message, message.getJMSDeliveryMode(), message.getJMSPriority(), getTimeToLive(message));
  } else {
    super.doSend(producer, message);
  }
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testPersistentDeliveryMode() throws Exception {
 queueProducer.setDeliveryMode(DeliveryMode.PERSISTENT);
 ProxyAssertSupport.assertEquals(DeliveryMode.PERSISTENT, queueProducer.getDeliveryMode());
 Message m = queueProducerSession.createMessage();
 queueProducer.send(m);
 ProxyAssertSupport.assertEquals(DeliveryMode.PERSISTENT, queueConsumer.receive().getJMSDeliveryMode());
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testPersistentSend() throws Exception {
 prepareMessage(message);
 queueProd.setDeliveryMode(DeliveryMode.PERSISTENT);
 queueProd.send(message);
 Message r = queueCons.receive(1000);
 ProxyAssertSupport.assertNotNull(r);
 ProxyAssertSupport.assertEquals(DeliveryMode.PERSISTENT, r.getJMSDeliveryMode());
 assertEquivalent(r, DeliveryMode.PERSISTENT);
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testNonPersistentDeliveryMode() throws Exception {
 queueProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
 ProxyAssertSupport.assertEquals(DeliveryMode.NON_PERSISTENT, queueProducer.getDeliveryMode());
 Message m = queueProducerSession.createMessage();
 queueProducer.send(m);
 ProxyAssertSupport.assertEquals(DeliveryMode.NON_PERSISTENT, queueConsumer.receive().getJMSDeliveryMode());
}

代码示例来源:origin: rabbitmq/rabbitmq-jms-client

@Override
public void send(Destination destination, Message message) throws JMSException {
  internalSend((RMQDestination) destination, message,
    message.propertyExists(JMS_MESSAGE_DELIVERY_MODE) ? message.getJMSDeliveryMode() : getDeliveryMode(),
    message.propertyExists(JMS_MESSAGE_PRIORITY) ? message.getJMSPriority() : getPriority(),
    message.propertyExists(JMS_MESSAGE_EXPIRATION) ? message.getJMSExpiration() : getTimeToLive(),
    message.propertyExists(JMS_MESSAGE_EXPIRATION) ? MessageExpirationType.EXPIRATION : MessageExpirationType.TTL);
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testNonPersistentSend() throws Exception {
 prepareMessage(message);
 queueProd.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
 queueProd.send(message);
 log.debug("Message sent");
 Message r = queueCons.receive(2000);
 ProxyAssertSupport.assertNotNull(r);
 log.debug("Message received");
 ProxyAssertSupport.assertEquals(DeliveryMode.NON_PERSISTENT, r.getJMSDeliveryMode());
 assertEquivalent(r, DeliveryMode.NON_PERSISTENT);
}

相关文章