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

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

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

Message.setByteProperty介绍

[英]Sets a byte property value with the specified name into the message.
[中]在消息中设置具有指定名称的字节属性值。

代码示例

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

message.setLongProperty(jmsPropName, Long.parseLong(value));
} else if (type.equalsIgnoreCase(PROP_TYPE_BYTE)) {
  message.setByteProperty(jmsPropName, Byte.parseByte(value));
} else if (type.equalsIgnoreCase(PROP_TYPE_DOUBLE)) {
  message.setDoubleProperty(jmsPropName, Double.parseDouble(value));

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

public void setByteProperty(String name, byte value) throws JMSException
{
 message.setByteProperty(name, value);
}

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

@Override
public void setByteProperty(final String name, final byte value) throws JMSException {
  message.setByteProperty(name, value);
}

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

public void setByteProperty(String name, byte value) throws JMSException {
  message.setByteProperty(name, value);
}

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

/**
* Set property
* @param name The name
* @param value The value
* @exception JMSException Thrown if an error occurs
*/
public void setByteProperty(final String name, final byte value) throws JMSException
{
 if (_log.isTraceEnabled())
 {
   _log.trace("setByteProperty(" + name + ", " + value + ")");
 }
 _message.setByteProperty(name, value);
}

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

/**
* Set property
*
* @param name  The name
* @param value The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public void setByteProperty(final String name, final byte value) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("setByteProperty(" + name + ", " + value + ")");
 }
 message.setByteProperty(name, value);
}

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

/**
* Set property
*
* @param name  The name
* @param value The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public void setByteProperty(final String name, final byte value) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("setByteProperty(" + name + ", " + value + ")");
 }
 message.setByteProperty(name, value);
}

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

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

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

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

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

/**
* if a property is set as a <code>byte</code>, 
* it can also be read as a <code>byte</code>.
*/
public void testByte2Byte()
{
 try
 {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   assertEquals((byte) 127, message.getByteProperty("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>String</code>.
*/
@Test
public void testByte2String() {
 try {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   Assert.assertEquals("127", message.getStringProperty("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>short</code>.
*/
@Test
public void testByte2Short() {
 try {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   Assert.assertEquals((short) 127, message.getShortProperty("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>byte</code>.
*/
@Test
public void testByte2Byte() {
 try {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   Assert.assertEquals((byte) 127, message.getByteProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

private void sendMessageUsingOpenWire(String queueName) throws Exception {
 Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
 System.out.println("destination: " + destination);
 final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
 javax.jms.Message message = session.createMessage();
 message.setBooleanProperty("booleanProperty", false);
 message.setLongProperty("longProperty", 99999L);
 message.setByteProperty("byteProperty", (byte) 5);
 message.setIntProperty("intProperty", 979);
 message.setShortProperty("shortProperty", (short) 1099);
 message.setStringProperty("stringProperty", "HelloMessage");
 producer.send(message);
}

代码示例来源: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 a <code>byte</code>,
* it can also be read as an <code>int</code>.
*/
@Test
public void testByte2Int() {
 try {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   Assert.assertEquals(127, message.getIntProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>byte</code>,
* to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testByte2Float() {
 try {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   message.getFloatProperty("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>byte</code>,
* to get is as a <code>double</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testByte2Double() {
 try {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   message.getDoubleProperty("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>byte</code>,
* to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testByte2Boolean() {
 try {
   Message message = senderSession.createMessage();
   // store a value that can't be converted to boolean
   message.setByteProperty("prop", (byte) 127);
   message.getBooleanProperty("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

protected void prepareMessage(final Message m) throws JMSException {
 m.setBooleanProperty("booleanProperty", true);
 m.setByteProperty("byteProperty", (byte) 3);
 m.setDoubleProperty("doubleProperty", 4.0);
 m.setFloatProperty("floatProperty", 5.0f);
 m.setIntProperty("intProperty", 6);
 m.setLongProperty("longProperty", 7);
 m.setShortProperty("shortProperty", (short) 8);
 m.setStringProperty("stringProperty", "this is a String property");
 m.setJMSCorrelationID("this is the correlation ID");
 m.setJMSReplyTo(ActiveMQServerTestCase.topic1);
 m.setJMSType("someArbitraryType");
}

相关文章