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

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

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

Message.setJMSDeliveryMode介绍

[英]Sets the DeliveryMode value for this message.

This method is for use by JMS providers only to set this field when a message is sent. This message cannot be used by clients to configure the delivery mode of the message. This method is public to allow a JMS provider to set this field when sending a message whose implementation is not its own.
[中]设置此邮件的DeliveryMode值。
此方法仅供JMS提供程序在发送消息时用于设置此字段。客户端无法使用此邮件配置邮件的传递模式。此方法是公共的,允许JMS提供程序在发送非其自身实现的消息时设置此字段。

代码示例

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

try {
  if (entry.getKey().equals(JmsHeaders.DELIVERY_MODE)) {
    message.setJMSDeliveryMode(Integer.parseInt(entry.getValue()));
  } else if (entry.getKey().equals(JmsHeaders.EXPIRATION)) {
    message.setJMSExpiration(Integer.parseInt(entry.getValue()));

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

@Test
public void jmsDeliveryModeMappedToHeader() throws JMSException {
  int deliveryMode = 1;
  javax.jms.Message jmsMessage = new StubTextMessage();
  jmsMessage.setJMSDeliveryMode(deliveryMode);
  assertInboundHeader(jmsMessage, JmsHeaders.DELIVERY_MODE, deliveryMode);
}

代码示例来源: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: apache/activemq

message.setJMSDeliveryMode(deliveryMode);
long expiration = 0L;
if (!producer.getDisableMessageTimestamp()) {

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

CompletionListener completionListener) throws JMSException {
jmsMessage.setJMSDeliveryMode(deliveryMode);

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

public void setJMSDeliveryMode(int deliveryMode) throws JMSException
{
 message.setJMSDeliveryMode(deliveryMode);
}

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

@Override
public void setJMSDeliveryMode(final int deliveryMode) throws JMSException {
  message.setJMSDeliveryMode(deliveryMode);
}

代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar

public void setJMSDeliveryMode(int deliveryMode) throws JMSException {
  message.setJMSDeliveryMode(deliveryMode);
}

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

/**
* Set delivery mode
* @param deliveryMode The value
* @exception JMSException Thrown if an error occurs
*/
public void setJMSDeliveryMode(final int deliveryMode) throws JMSException
{
 if (_log.isTraceEnabled())
 {
   _log.trace("setJMSDeliveryMode(" + deliveryMode + ")");
 }
 _message.setJMSDeliveryMode(deliveryMode);
}

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

protected Message createJmsMessage(Exception cause, Session session) throws JMSException {
  LOG.trace("Using JmsMessageType: {}", Object);
  Message answer = session.createObjectMessage(cause);
  // ensure default delivery mode is used by default
  answer.setJMSDeliveryMode(Message.DEFAULT_DELIVERY_MODE);
  return answer;
}

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

/**
* Set delivery mode
*
* @param deliveryMode The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public void setJMSDeliveryMode(final int deliveryMode) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("setJMSDeliveryMode(" + deliveryMode + ")");
 }
 message.setJMSDeliveryMode(deliveryMode);
}

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

/**
* Set delivery mode
*
* @param deliveryMode The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public void setJMSDeliveryMode(final int deliveryMode) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("setJMSDeliveryMode(" + deliveryMode + ")");
 }
 message.setJMSDeliveryMode(deliveryMode);
}

代码示例来源:origin: org.jboss.javaee/jboss-jms-api-1.1_spec

public Message request(Message message) throws JMSException
{
 message.setJMSReplyTo(replyQueue);
 message.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
 requestSender.send(message);
 return replyReceiver.receive();
}

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

public void send(final Message message) throws JMSException
{
 checkClosed();
 message.setJMSDeliveryMode(defaultDeliveryMode);
 message.setJMSPriority(defaultPriority);
 doSend(message, defaultTimeToLive, null);
}

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

public void send(final Message message, final int deliveryMode, final int priority, final long timeToLive) throws JMSException
{
 checkClosed();
 message.setJMSDeliveryMode(deliveryMode);
 message.setJMSPriority(priority);
 doSend(message, timeToLive, null);
}

代码示例来源:origin: org.jboss.javaee/jboss-javaee

public Message request(Message message) throws JMSException
{
 message.setJMSReplyTo(replyQueue);
 message.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
 requestSender.send(message);
 return replyReceiver.receive();
}

代码示例来源:origin: org.jboss.javaee/jboss-jms-api

public Message request(Message message) throws JMSException
{
 message.setJMSReplyTo(replyQueue);
 message.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
 requestSender.send(message);
 return replyReceiver.receive();
}

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

public void send(final Destination destination, final Message message) throws JMSException
{
 checkClosed();
 if (destination != null && !(destination instanceof HornetQDestination))
 {
   throw new InvalidDestinationException("Not a HornetQ Destination:" + destination);
 }
 message.setJMSDeliveryMode(defaultDeliveryMode);
 message.setJMSPriority(defaultPriority);
 doSend(message, defaultTimeToLive, (HornetQDestination)destination);
}

代码示例来源:origin: timewalker74/ffmq

protected final void setupMessage( Destination destinationRef , Message message , int deliveryMode , int priority , long timeToLive) throws JMSException
{
  long now = System.currentTimeMillis();
  
  // Setup headers
  message.setJMSMessageID(uuidProvider.getUUID());
  message.setJMSTimestamp(disableMessageTimestamp ? 0 : now);
  message.setJMSDeliveryMode(deliveryMode);
  message.setJMSPriority(priority);
  message.setJMSExpiration(timeToLive > 0 ? timeToLive+now : 0);
  message.setJMSDestination(destinationRef);
}

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

public void send(final Destination destination,
        final Message message,
        final int deliveryMode,
        final int priority,
        final long timeToLive) throws JMSException
{
 checkClosed();
 if (destination != null && !(destination instanceof HornetQDestination))
 {
   throw new InvalidDestinationException("Not a HornetQ Destination:" + destination);
 }
 message.setJMSDeliveryMode(deliveryMode);
 message.setJMSPriority(priority);
 doSend(message, timeToLive, (HornetQDestination)destination);
}

相关文章