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

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

本文整理了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

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

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

  1. public long getLongProperty(String name) throws JMSException
  2. {
  3. return message.getLongProperty(name);
  4. }

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

  1. /**
  2. * Gets a JMS property in a safe way
  3. *
  4. * @param jmsMessage the JMS message
  5. * @param name name of the property to get
  6. * @return the property value, or <tt>null</tt> if does not exists or failure to get the value
  7. */
  8. public static Long getSafeLongProperty(Message jmsMessage, String name) {
  9. try {
  10. return jmsMessage.getLongProperty(name);
  11. } catch (Exception e) {
  12. // ignore
  13. }
  14. return null;
  15. }

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

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

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

  1. /**
  2. * Get property
  3. * @param name The name
  4. * @return The value
  5. * @exception JMSException Thrown if an error occurs
  6. */
  7. public long getLongProperty(final String name) throws JMSException
  8. {
  9. if (_log.isTraceEnabled())
  10. {
  11. _log.trace("getLongProperty(" + name + ")");
  12. }
  13. return _message.getLongProperty(name);
  14. }

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

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

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

  1. public long getMessageLongProperty(String aMessagePropertyName) throws AsynchAEException {
  2. try {
  3. return message.getLongProperty(aMessagePropertyName);
  4. } catch (Exception e) {
  5. throw new AsynchAEException(e);
  6. }
  7. }

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

  1. /**
  2. * Get property
  3. *
  4. * @param name The name
  5. * @return The value
  6. * @throws JMSException Thrown if an error occurs
  7. */
  8. @Override
  9. public long getLongProperty(final String name) throws JMSException {
  10. if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
  11. ActiveMQRALogger.LOGGER.trace("getLongProperty(" + name + ")");
  12. }
  13. return message.getLongProperty(name);
  14. }

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

  1. /**
  2. * Get property
  3. *
  4. * @param name The name
  5. * @return The value
  6. * @throws JMSException Thrown if an error occurs
  7. */
  8. @Override
  9. public long getLongProperty(final String name) throws JMSException {
  10. if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
  11. ActiveMQRALogger.LOGGER.trace("getLongProperty(" + name + ")");
  12. }
  13. return message.getLongProperty(name);
  14. }

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

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

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

  1. /**
  2. * if a property is set as an <code>int</code>,
  3. * it can also be read as a <code>long</code>.
  4. */
  5. public void testInt2Long()
  6. {
  7. try
  8. {
  9. Message message = senderSession.createMessage();
  10. message.setIntProperty("prop", 127);
  11. assertEquals(127L, message.getLongProperty("prop"));
  12. }
  13. catch (JMSException e)
  14. {
  15. fail(e);
  16. }
  17. }

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

  1. @Test
  2. public void testJMSXDeliveryCountConversion() throws Exception {
  3. Message m1 = queueProducerSession.createMessage();
  4. queueProducer.send(m1);
  5. Message m2 = queueConsumer.receive(2000);
  6. int count = m2.getIntProperty("JMSXDeliveryCount");
  7. ProxyAssertSupport.assertEquals(String.valueOf(count), m2.getStringProperty("JMSXDeliveryCount"));
  8. ProxyAssertSupport.assertEquals(count, m2.getLongProperty("JMSXDeliveryCount"));
  9. }
  10. }

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

  1. /**
  2. * Test that an attempt to get a <code>long</code> property which does not exist throw
  3. * a <code>java.lang.NumberFormatException</code>
  4. */
  5. @Test
  6. public void testGetLongProperty() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.getLongProperty("prop");
  10. Assert.fail("Should raise a NumberFormatException.\n");
  11. } catch (NumberFormatException e) {
  12. } catch (JMSException e) {
  13. fail(e);
  14. }
  15. }

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

  1. /**
  2. * if a property is set as a <code>long</code>,
  3. * it can also be read as a <code>long</code>.
  4. */
  5. @Test
  6. public void testLong2Long() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setLongProperty("prop", 127L);
  10. Assert.assertEquals(127L, message.getLongProperty("prop"));
  11. } catch (JMSException e) {
  12. fail(e);
  13. }
  14. }

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

  1. /**
  2. * if a property is set as a <code>short</code>,
  3. * it can also be read as a <code>long</code>.
  4. */
  5. @Test
  6. public void testShort2Long() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setShortProperty("prop", (short) 127);
  10. Assert.assertEquals(127L, message.getLongProperty("prop"));
  11. } catch (JMSException e) {
  12. fail(e);
  13. }
  14. }

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

  1. /**
  2. * if a property is set as a <code>java.lang.String</code>,
  3. * it can also be read as a <code>long</code> as long as the <code>String</code>
  4. * is a correct representation of a <code>long</code> (e.g. <code>"0"</code>).
  5. */
  6. @Test
  7. public void testString2Long_1() {
  8. try {
  9. Message message = senderSession.createMessage();
  10. message.setStringProperty("prop", "0");
  11. Assert.assertEquals(0L, message.getLongProperty("prop"));
  12. } catch (JMSException e) {
  13. fail(e);
  14. }
  15. }

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

  1. /**
  2. * if a property is set as a <code>byte</code>,
  3. * it can also be read as a <code>long</code>.
  4. */
  5. @Test
  6. public void testByte2Long() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setByteProperty("prop", (byte) 127);
  10. Assert.assertEquals(127L, message.getLongProperty("prop"));
  11. } catch (JMSException e) {
  12. fail(e);
  13. }
  14. }

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

  1. /**
  2. * if a property is set as an <code>int</code>,
  3. * it can also be read as a <code>long</code>.
  4. */
  5. @Test
  6. public void testInt2Long() {
  7. try {
  8. Message message = senderSession.createMessage();
  9. message.setIntProperty("prop", 127);
  10. Assert.assertEquals(127L, message.getLongProperty("prop"));
  11. } catch (JMSException e) {
  12. fail(e);
  13. }
  14. }

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

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

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

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

相关文章