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

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

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

Message.getJMSCorrelationIDAsBytes介绍

[英]Gets the correlation ID as an array of bytes for the message.

The use of a byte[] value for JMSCorrelationID is non-portable.
[中]获取相关ID作为消息的字节数组。
JMSCorrelationID使用byte[]值是不可移植的。

代码示例

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

byte[] corrIDBytes = foreign.getJMSCorrelationIDAsBytes();
 setJMSCorrelationIDAsBytes(corrIDBytes);
} catch (JMSException e) {

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

@Override
public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
  return message.getJMSCorrelationIDAsBytes();
}

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

public byte[] getJMSCorrelationIDAsBytes() throws JMSException
{
 return message.getJMSCorrelationIDAsBytes();
}

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

public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
  return message.getJMSCorrelationIDAsBytes();
}

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

/**
* Get correlation id
* @return The value
* @exception JMSException Thrown if an error occurs
*/
public byte[] getJMSCorrelationIDAsBytes() throws JMSException
{
 if (_log.isTraceEnabled())
 {
   _log.trace("getJMSCorrelationIDAsBytes()");
 }
 return _message.getJMSCorrelationIDAsBytes();
}

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

/**
   * Gets the JMSCorrelationIDAsBytes from the message.
   *
   * @param message the message
   * @return the JMSCorrelationIDAsBytes, or <tt>null</tt> if not able to get
   */
  public static String getJMSCorrelationIDAsBytes(Message message) {
    try {
      byte[] bytes = message.getJMSCorrelationIDAsBytes();
      boolean isNull = true;
      for (byte b : bytes) {
        if (b != 0) {
          isNull = false;
        }
      }
      return isNull ? null : new String(bytes);
    } catch (Exception e) {
      // ignore if JMS broker do not support this
    }
    return null;
  }
}

代码示例来源:origin: org.seasar.jms/s2jms-core

/**
 * JMSメッセージの{@link javax.jms.Message#getJMSCorrelationIDAsBytes correlationID}
 * ヘッダの値をバイト列で返します。
 * 
 * @return JMSメッセージの{@link javax.jms.Message#getJMSCorrelationIDAsBytes correlationID}ヘッダの値のバイト列
 * @throws SJMSRuntimeException
 *             JMS実装で例外が発生した場合にスローされます
 */
public byte[] getCorrelationIDAsBytes() {
  try {
    return message.getJMSCorrelationIDAsBytes();
  } catch (final JMSException e) {
    throw new SJMSRuntimeException("EJMS0001", new Object[] { e }, e);
  }
}

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

/**
* Get correlation id
*
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("getJMSCorrelationIDAsBytes()");
 }
 return message.getJMSCorrelationIDAsBytes();
}

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

/**
* Get correlation id
*
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("getJMSCorrelationIDAsBytes()");
 }
 return message.getJMSCorrelationIDAsBytes();
}

代码示例来源:origin: ibm-messaging/kafka-connect-mq-source

case CORRELATION_ID_AS_BYTES:
  keySchema = Schema.OPTIONAL_BYTES_SCHEMA;
  key = message.getJMSCorrelationIDAsBytes();
  break;
default:

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

@Test
public void testForeignMessageCorrelationIDBytesDisabled() throws Exception {
 System.setProperty(ActiveMQJMSConstants.JMS_ACTIVEMQ_ENABLE_BYTE_ARRAY_JMS_CORRELATION_ID_PROPERTY_NAME, "false");
 SimpleJMSMessage msg = new SimpleJMSMessage();
 msg.setJMSCorrelationID("mycorrelationid");
 byte[] bytes = new byte[]{1, 4, 3, 6, 8};
 msg.setJMSCorrelationIDAsBytes(bytes);
 queueProd.send(msg);
 Message rec = queueCons.receive();
 ProxyAssertSupport.assertNotNull(rec);
 Assert.assertNull(rec.getJMSCorrelationIDAsBytes());
 Assert.assertEquals("mycorrelationid", msg.getJMSCorrelationID());
}

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

@Test
public void testForeignMessageCorrelationID() throws Exception {
 System.setProperty(ActiveMQJMSConstants.JMS_ACTIVEMQ_ENABLE_BYTE_ARRAY_JMS_CORRELATION_ID_PROPERTY_NAME, "true");
 SimpleJMSMessage msg = new SimpleJMSMessage();
 msg.setJMSCorrelationID("mycorrelationid");
 byte[] bytes = new byte[]{1, 4, 3, 6, 8};
 msg.setJMSCorrelationIDAsBytes(bytes);
 queueProd.send(msg);
 Message rec = queueCons.receive();
 ProxyAssertSupport.assertNotNull(rec);
 //Bytes correlation id takes precedence
 byte[] bytesrec = rec.getJMSCorrelationIDAsBytes();
 assertByteArraysEqual(bytes, bytesrec);
 Assert.assertNull(rec.getJMSCorrelationID());
}

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

@Test
public void testJMSDestination() throws Exception {
 Message m1 = queueProducerSession.createMessage();
 // Test with correlation id containing a message id
 final String messageID = "ID:812739812378";
 m1.setJMSCorrelationID(messageID);
 queueProducer.send(m1);
 Message m2 = queueConsumer.receive();
 ProxyAssertSupport.assertEquals(messageID, m2.getJMSCorrelationID());
 // Test with correlation id containing an application defined string
 Message m3 = queueProducerSession.createMessage();
 final String appDefinedID = "oiwedjiwjdoiwejdoiwjd";
 m3.setJMSCorrelationID(appDefinedID);
 queueProducer.send(m3);
 Message m4 = queueConsumer.receive();
 ProxyAssertSupport.assertEquals(appDefinedID, m4.getJMSCorrelationID());
 // Test with correlation id containing a byte[]
 Message m5 = queueProducerSession.createMessage();
 final byte[] bytes = new byte[]{-111, 45, 106, 3, -44};
 m5.setJMSCorrelationIDAsBytes(bytes);
 queueProducer.send(m5);
 Message m6 = queueConsumer.receive();
 assertByteArraysEqual(bytes, m6.getJMSCorrelationIDAsBytes());
}

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

byte[] corrIDBytes = foreign.getJMSCorrelationIDAsBytes();
 setJMSCorrelationIDAsBytes(corrIDBytes);
} catch (JMSException e) {

代码示例来源:origin: org.jboss.eap/wildfly-client-all

byte[] corrIDBytes = foreign.getJMSCorrelationIDAsBytes();
 setJMSCorrelationIDAsBytes(corrIDBytes);
} catch (JMSException e) {

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

byte[] corrIDBytes = foreign.getJMSCorrelationIDAsBytes();
 setJMSCorrelationIDAsBytes(corrIDBytes);
} catch (JMSException e) {

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

byte[] corrIDBytes = foreign.getJMSCorrelationIDAsBytes();
 setJMSCorrelationIDAsBytes(corrIDBytes);
} catch (JMSException e) {

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

byte[] corrIDBytes = foreign.getJMSCorrelationIDAsBytes();
setJMSCorrelationIDAsBytes(corrIDBytes);

代码示例来源:origin: se.ugli.jocote/jocote

private static Map<String, Object> headers(final javax.jms.Message message) throws JMSException {
  final Map<String, Object> result = new HashMap<>();
  putHeadedIfPresent(result, CorrelationID, message.getJMSCorrelationID());
  putHeadedIfPresent(result, CorrelationIDAsBytes, message.getJMSCorrelationIDAsBytes());
  putHeadedIfPresent(result, DeliveryMode, message.getJMSDeliveryMode());
  putHeadedIfPresent(result, Destination, message.getJMSDestination());
  putHeadedIfPresent(result, Expiration, message.getJMSExpiration());
  putHeadedIfPresent(result, MessageID, message.getJMSMessageID());
  putHeadedIfPresent(result, Priority, message.getJMSPriority());
  putHeadedIfPresent(result, Redelivered, message.getJMSRedelivered());
  putHeadedIfPresent(result, ReplyTo, message.getJMSReplyTo());
  putHeadedIfPresent(result, Timestamp, message.getJMSTimestamp());
  putHeadedIfPresent(result, Type, message.getJMSType());
  return result;
}

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

corrIDBytes = m1.getJMSCorrelationIDAsBytes();
} catch (JMSException e) {

相关文章