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

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

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

Message.setJMSDestination介绍

[英]Sets the Destination object 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 destination 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.
[中]设置此消息的目标对象。
此方法仅供JMS提供程序在发送消息时用于设置此字段。客户端无法使用此消息配置消息的目标。此方法是公共的,允许JMS提供程序在发送非其自身实现的消息时设置此字段。

代码示例

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

Destination destination = buildDestination(entry.getValue());
if (destination != null) {
  message.setJMSDestination(destination);
} else {
  logUnbuildableDestination(entry.getKey(), JmsHeaders.DESTINATION);

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

@Test
public void destinationMappedToHeader() throws JMSException {
  Destination destination = new Destination() {};
  javax.jms.Message jmsMessage = new StubTextMessage();
  jmsMessage.setJMSDestination(destination);
  assertInboundHeader(jmsMessage, JmsHeaders.DESTINATION, destination);
}

代码示例来源: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.setJMSMessageID(msg.getMessageId().toString());
message.setJMSDestination(destination);

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

jmsMessage.setJMSDestination(destination);

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

public void setJMSDestination(Destination destination) throws JMSException
{
 message.setJMSDestination(destination);
}

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

@Override
public void setJMSDestination(final Destination destination) throws JMSException {
  message.setJMSDestination(destination);
}

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

public void setJMSDestination(Destination destination) throws JMSException {
  message.setJMSDestination(destination);
}

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

/**
* Set destination
* @param destination The value
* @exception JMSException Thrown if an error occurs
*/
public void setJMSDestination(final Destination destination) throws JMSException
{
 if (_log.isTraceEnabled())
 {
   _log.trace("setJMSDestination(" + destination + ")");
 }
 _message.setJMSDestination(destination);
}

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

/**
* Set destination
*
* @param destination The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public void setJMSDestination(final Destination destination) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("setJMSDestination(" + destination + ")");
 }
 message.setJMSDestination(destination);
}

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

/**
* Set destination
*
* @param destination The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public void setJMSDestination(final Destination destination) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("setJMSDestination(" + destination + ")");
 }
 message.setJMSDestination(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: apache/activemq-artemis

@Test
public void testSendForeignWithForeignDestinationSet() throws Exception {
 Connection conn = createConnection();
 Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 MessageProducer p = sess.createProducer(queue1);
 MessageConsumer c = sess.createConsumer(queue1);
 conn.start();
 Message foreign = new SimpleJMSMessage(new SimpleDestination());
 foreign.setJMSDestination(new SimpleDestination());
 // the producer destination should override the foreign destination and the send should succeed
 p.send(foreign);
 Message m = c.receive(1000);
 ProxyAssertSupport.assertNotNull(m);
}

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

@Test
public void testForeignJMSDestination() throws JMSException {
 Message message = queueProducerSession.createMessage();
 Destination foreignDestination = new ForeignDestination();
 message.setJMSDestination(foreignDestination);
 ProxyAssertSupport.assertSame(foreignDestination, message.getJMSDestination());
 queueProducer.send(message);
 ProxyAssertSupport.assertSame(queue1, message.getJMSDestination());
 Message receivedMessage = queueConsumer.receive(2000);
 MessageHeaderTestBase.ensureEquivalent(receivedMessage, (ActiveMQMessage) message);
}

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

/**
   * 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: org.fusesource.stompjms/stompjms-client

/**
   * 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(StompJmsConnection connection, Message fromMessage, Message toMessage) throws JMSException {
    toMessage.setJMSMessageID(fromMessage.getJMSMessageID());
    toMessage.setJMSCorrelationID(fromMessage.getJMSCorrelationID());
    toMessage.setJMSReplyTo(transformDestination(connection, fromMessage.getJMSReplyTo()));
    toMessage.setJMSDestination(transformDestination(connection, 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: org.apache.activemq/activemq-all

/**
   * 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: org.apache.activemq/activemq-osgi

/**
   * 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: fusesource/stompjms

/**
   * 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(StompJmsConnection connection, Message fromMessage, Message toMessage) throws JMSException {
    toMessage.setJMSMessageID(fromMessage.getJMSMessageID());
    toMessage.setJMSCorrelationID(fromMessage.getJMSCorrelationID());
    toMessage.setJMSReplyTo(transformDestination(connection, fromMessage.getJMSReplyTo()));
    toMessage.setJMSDestination(transformDestination(connection, 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: pierre/meteo

/**
   * 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);
    }
  }
}

相关文章