本文整理了Java中javax.jms.Message.setShortProperty()
方法的一些代码示例,展示了Message.setShortProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setShortProperty()
方法的具体详情如下:
包路径:javax.jms.Message
类名称:Message
方法名:setShortProperty
[英]Sets a short property value with the specified name into the message.
[中]在消息中设置具有指定名称的短属性值。
代码示例来源:origin: apache/nifi
message.setBooleanProperty(jmsPropName, Boolean.parseBoolean(value));
} else if (type.equalsIgnoreCase(PROP_TYPE_SHORT)) {
message.setShortProperty(jmsPropName, Short.parseShort(value));
} else if (type.equalsIgnoreCase(PROP_TYPE_LONG)) {
message.setLongProperty(jmsPropName, Long.parseLong(value));
代码示例来源:origin: org.apache.tomee/openejb-core
@Override
public void setShortProperty(final String name, final short value) throws JMSException {
message.setShortProperty(name, value);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-connector
public void setShortProperty(String name, short value) throws JMSException
{
message.setShortProperty(name, value);
}
代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar
public void setShortProperty(String name, short value) throws JMSException {
message.setShortProperty(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 setShortProperty(final String name, final short value) throws JMSException
{
if (_log.isTraceEnabled())
{
_log.trace("setShortProperty(" + name + ", " + value + ")");
}
_message.setShortProperty(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 setShortProperty(final String name, final short value) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("setShortProperty(" + name + ", " + value + ")");
}
message.setShortProperty(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 setShortProperty(final String name, final short value) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("setShortProperty(" + name + ", " + value + ")");
}
message.setShortProperty(name, value);
}
代码示例来源:origin: objectweb-joramtests/joramtests
/**
* if a property is set as a <code>short</code>,
* it can also be read as an <code>int</code>.
*/
public void testShort2Int()
{
try
{
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 127);
assertEquals(127, message.getIntProperty("prop"));
}
catch (JMSException e)
{
fail(e);
}
}
代码示例来源:origin: objectweb-joramtests/joramtests
/**
* if a property is set as a <code>short</code>,
* it can also be read as a <code>short</code>.
*/
public void testShort2Short()
{
try
{
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 127);
assertEquals((short) 127, message.getShortProperty("prop"));
}
catch (JMSException e)
{
fail(e);
}
}
代码示例来源:origin: objectweb-joramtests/joramtests
/**
* if a property is set as a <code>short</code>,
* it can also be read as a <code>String</code>.
*/
public void testShort2String()
{
try
{
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 127);
assertEquals("127", message.getStringProperty("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>short</code>,
* it can also be read as an <code>int</code>.
*/
@Test
public void testShort2Int() {
try {
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 127);
Assert.assertEquals(127, message.getIntProperty("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>String</code>.
*/
@Test
public void testShort2String() {
try {
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 127);
Assert.assertEquals("127", message.getStringProperty("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>short</code>.
*/
@Test
public void testShort2Short() {
try {
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 127);
Assert.assertEquals((short) 127, message.getShortProperty("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>short</code>,
* to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testShort2Float() {
try {
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 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>short</code>,
* to get is as a <code>double</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testShort2Double() {
try {
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 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>short</code>,
* to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testShort2Byte() {
try {
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 127);
message.getByteProperty("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>short</code>,
* to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testShort2Boolean() {
try {
Message message = senderSession.createMessage();
// store a value that can't be converted to boolean
message.setShortProperty("prop", (short) 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");
}
内容来源于网络,如有侵权,请联系作者删除!