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

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

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

Message.getLongProperty介绍

[英]Returns the value of the long property with the specified name.
[中]返回具有指定名称的long属性的值。

代码示例

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

@Override
public long getLongProperty(final String name) throws JMSException {
  return message.getLongProperty(name);
}

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

public long getLongProperty(String name) throws JMSException
{
 return message.getLongProperty(name);
}

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

/**
 * Gets a JMS property in a safe way
 *
 * @param jmsMessage the JMS message
 * @param name       name of the property to get
 * @return the property value, or <tt>null</tt> if does not exists or failure to get the value
 */
public static Long getSafeLongProperty(Message jmsMessage, String name) {
  try {
    return jmsMessage.getLongProperty(name);
  } catch (Exception e) {
    // ignore
  }
  return null;
}

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

public long getLongProperty(String name) throws JMSException {
  return message.getLongProperty(name);
}

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

/**
* Get property
* @param name The name
* @return The value
* @exception JMSException Thrown if an error occurs
*/
public long getLongProperty(final String name) throws JMSException
{
 if (_log.isTraceEnabled())
 {
   _log.trace("getLongProperty(" + name + ")");
 }
 return _message.getLongProperty(name);
}

代码示例来源:origin: org.apache.james/james-server-queue-jms

private ZonedDateTime nextDeliveryDate(Message m) throws JMSException {
  long nextDeliveryTimestamp = m.getLongProperty(JAMES_NEXT_DELIVERY);
  return Instant.ofEpochMilli(nextDeliveryTimestamp).atZone(ZoneId.systemDefault());
}

代码示例来源:origin: org.apache.uima/uimaj-as-jms

public long getMessageLongProperty(String aMessagePropertyName) throws AsynchAEException {
 try {
  return message.getLongProperty(aMessagePropertyName);
 } catch (Exception e) {
  throw new AsynchAEException(e);
 }
}

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

/**
* Get property
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public long getLongProperty(final String name) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("getLongProperty(" + name + ")");
 }
 return message.getLongProperty(name);
}

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

/**
* Get property
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public long getLongProperty(final String name) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("getLongProperty(" + name + ")");
 }
 return message.getLongProperty(name);
}

代码示例来源:origin: eclipse/kapua

private KapuaConnectionContext parseMessageSession(javax.jms.Message message) throws JMSException, KapuaException {
  Long scopeId = message.propertyExists(MessageConstants.PROPERTY_SCOPE_ID) ? message.getLongProperty(MessageConstants.PROPERTY_SCOPE_ID) : null;
  String clientId = message.getStringProperty(MessageConstants.PROPERTY_CLIENT_ID);
  if (scopeId == null || scopeId <= 0 || StringUtils.isEmpty(clientId)) {
    logger.debug("Invalid message context. Try parsing the topic.");
    throw new KapuaException(KapuaErrorCodes.ILLEGAL_ARGUMENT, "Invalid message context");
  }
  return new KapuaConnectionContext(scopeId, clientId, MULTI_ACCOUNT_CLIENT_ID);
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* if a property is set as an <code>int</code>, 
* it can also be read as a <code>long</code>.
*/
public void testInt2Long()
{
 try
 {
   Message message = senderSession.createMessage();
   message.setIntProperty("prop", 127);
   assertEquals(127L, message.getLongProperty("prop"));
 }
 catch (JMSException e)
 {
   fail(e);
 }
}

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

@Test
  public void testJMSXDeliveryCountConversion() throws Exception {
   Message m1 = queueProducerSession.createMessage();
   queueProducer.send(m1);

   Message m2 = queueConsumer.receive(2000);

   int count = m2.getIntProperty("JMSXDeliveryCount");
   ProxyAssertSupport.assertEquals(String.valueOf(count), m2.getStringProperty("JMSXDeliveryCount"));
   ProxyAssertSupport.assertEquals(count, m2.getLongProperty("JMSXDeliveryCount"));
  }
}

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

/**
* Test that an attempt to get a <code>long</code> property which does not exist throw
* a <code>java.lang.NumberFormatException</code>
*/
@Test
public void testGetLongProperty() {
 try {
   Message message = senderSession.createMessage();
   message.getLongProperty("prop");
   Assert.fail("Should raise a NumberFormatException.\n");
 } catch (NumberFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>long</code>,
* it can also be read as a <code>long</code>.
*/
@Test
public void testLong2Long() {
 try {
   Message message = senderSession.createMessage();
   message.setLongProperty("prop", 127L);
   Assert.assertEquals(127L, message.getLongProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>short</code>,
* it can also be read as a <code>long</code>.
*/
@Test
public void testShort2Long() {
 try {
   Message message = senderSession.createMessage();
   message.setShortProperty("prop", (short) 127);
   Assert.assertEquals(127L, message.getLongProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>java.lang.String</code>,
* it can also be read as a <code>long</code> as long as the <code>String</code>
* is a correct representation of a <code>long</code> (e.g. <code>"0"</code>).
*/
@Test
public void testString2Long_1() {
 try {
   Message message = senderSession.createMessage();
   message.setStringProperty("prop", "0");
   Assert.assertEquals(0L, message.getLongProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>byte</code>,
* it can also be read as a <code>long</code>.
*/
@Test
public void testByte2Long() {
 try {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   Assert.assertEquals(127L, message.getLongProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as an <code>int</code>,
* it can also be read as a <code>long</code>.
*/
@Test
public void testInt2Long() {
 try {
   Message message = senderSession.createMessage();
   message.setIntProperty("prop", 127);
   Assert.assertEquals(127L, message.getLongProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>double</code>,
* to get is as a <code>long</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testDouble2Long() {
 try {
   Message message = senderSession.createMessage();
   message.setDoubleProperty("prop", 127.0);
   message.getLongProperty("prop");
   Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
 } catch (MessageFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>float</code>,
* to get is as a <code>long</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testFloat2Long() {
 try {
   Message message = senderSession.createMessage();
   message.setFloatProperty("prop", 127.0F);
   message.getLongProperty("prop");
   Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
 } catch (MessageFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

相关文章

微信公众号

最新文章

更多