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

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

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

Message.setBooleanProperty介绍

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

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Test
public void attemptToReadDisallowedUserPropertyIsNotFatal() throws JMSException {
  javax.jms.Message jmsMessage = new StubTextMessage() {
    @Override
    public Object getObjectProperty(String name) throws JMSException {
      if (name.equals("fail")) {
        throw new JMSException("illegal property");
      }
      else {
        return super.getObjectProperty(name);
      }
    }
  };
  jmsMessage.setBooleanProperty("fail", true);
  assertAttemptReadDisallowedPropertyIsNotFatal(jmsMessage, "fail");
}

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

message.setIntProperty(jmsPropName, Integer.parseInt(value));
} else if (type.equalsIgnoreCase(PROP_TYPE_BOOLEAN)) {
  message.setBooleanProperty(jmsPropName, Boolean.parseBoolean(value));
} else if (type.equalsIgnoreCase(PROP_TYPE_SHORT)) {
  message.setShortProperty(jmsPropName, Short.parseShort(value));

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

public void setBooleanProperty(String name, boolean value) throws JMSException
{
 message.setBooleanProperty(name, value);
}

代码示例来源:origin: org.ihtsdo.otf.common/otf-common

@Override
  public Message postProcessMessage(Message message) throws JMSException {
    message.setBooleanProperty(ERROR_FLAG, true);
    return message;
  }
};

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

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

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-beans

@AroundInvoke
public Object mdbInterceptor(InvocationContext ctx) throws Exception
{
  Object[] objArr = ctx.getParameters();
  Message msg = (Message)objArr[0];
  msg.setBooleanProperty("MethodLevelBusinessMethodInterception",true);
  ctx.setParameters(objArr);
  return ctx.proceed();
}

代码示例来源:origin: org.apache.openejb/openejb-itests-beans

@AroundInvoke
public Object aroundInvoke(final InvocationContext ctx) throws Exception {
  final Object[] objArr = ctx.getParameters();
  final Message msg = (Message) objArr[0];
  msg.setBooleanProperty("MethodLevelBusinessMethodInterception", true);
  ctx.setParameters(objArr);
  return ctx.proceed();
}

代码示例来源:origin: net.java.trueupdate/trueupdate-agent-impl-javaee

@Override
  protected UpdateMessage send(final UpdateMessage message) throws Exception {
    final Connection c = connectionFactory.createConnection();
    try {
      final Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
      final Message m = s.createObjectMessage(message);
      m.setBooleanProperty("manager", message.type().forManager());
      s.createProducer(destination).send(m);
    } finally {
      c.close();
    }
    return message;
  }
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-beans

@AroundInvoke
public Object mdbInterceptor(InvocationContext ctx) throws Exception
{
  Object[] objArr = ctx.getParameters();
  Message msg = (Message)objArr[0];
  msg.clearProperties();
  msg.setBooleanProperty("ClassLevelBusinessMethodInterception",true);
  ctx.setParameters(objArr);
  return ctx.proceed();
}

代码示例来源:origin: org.apache.openejb/openejb-itests-beans

@AroundInvoke
public Object mdbInterceptor(final InvocationContext ctx) throws Exception {
  final Object[] objArr = ctx.getParameters();
  final Message msg = (Message) objArr[0];
  msg.clearProperties();
  msg.setBooleanProperty("ClassLevelBusinessMethodInterception", true);
  ctx.setParameters(objArr);
  return ctx.proceed();
}

代码示例来源:origin: be.fedict.eid-trust-service/eid-trust-service-model

public Message getJMSMessage(Session session) throws JMSException {
    Message message = session.createMessage();
    message.setStringProperty(CA_NAME_PROPERTY, this.caName);
    message.setBooleanProperty(UPDATE_PROPERTY, this.update);
    return message;
  }
}

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

protected Message createJmsMessage(Exchange exchange, org.apache.camel.Message camelMessage, Session session, CamelContext context) throws JMSException {
  Message answer = createJmsMessage(exchange, camelMessage.getBody(), camelMessage.getHeaders(), session, context);
  // special for transferFault
  boolean isFault = camelMessage.isFault();
  if (answer != null && isFault && endpoint != null && endpoint.isTransferFault()) {
    answer.setBooleanProperty(JmsConstants.JMS_TRANSFER_FAULT, true);
  }
  return answer;
}

代码示例来源:origin: techa03/goodsKill

@Override
  public Message createMessage(Session session) throws JMSException {
    Message message = session.createMessage();
    message.setLongProperty("seckillId", finalSeckillId);
    message.setBooleanProperty("status", true);
    message.setStringProperty("note", note);
    return message;
  }
});

代码示例来源:origin: be.fedict.eid-trust-service/eid-trust-service-model

public Message getJMSMessage(Session session) throws JMSException {
    Message message = session.createMessage();
    message.setStringProperty(CA_NAME_PROPERTY, this.caName);
    message.setStringProperty(CRL_FILE_PROPERTY, this.crlFile);
    message.setBooleanProperty(UPDATE_PROPERTY, this.update);
    return message;
  }
}

代码示例来源:origin: Nepxion/Thunder

@Override
  public Message createMessage(Session session) throws JMSException {
    Message message = mqMessageConverter.toMessage(response, session);
    message.setBooleanProperty(ThunderConstant.ASYNC_ATTRIBUTE_NAME, response.isAsync());
    message.setLongProperty(ThunderConstant.TIMEOUT_ATTRIBUTE_NAME, response.getTimeout());
    MQSelectorUtil.setRequestSelector(message, selector);
    MQSelectorUtil.setResponseSelector(message, applicationEntity);
    return message;
  }
});

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

/**
  * if a property is set as a <code>boolean</code>,
  * it can also be read as a <code>boolean</code>.
  */
  @Test
  public void testBoolean2Boolean() {
   try {
     Message message = senderSession.createMessage();
     message.setBooleanProperty("prop", true);
     Assert.assertEquals(true, message.getBooleanProperty("prop"));
   } catch (JMSException e) {
     fail(e);
   }
  }
}

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

/**
* if a property is set as a <code>boolean</code>,
* it can also be read as a <code>String</code>.
*/
@Test
public void testBoolean2String() {
 try {
   Message message = senderSession.createMessage();
   message.setBooleanProperty("prop", true);
   Assert.assertEquals("true", message.getStringProperty("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

@Test
public void testResetToNull() throws JMSException {
 Message m1 = queueProducerSession.createMessage();
 m1.setStringProperty("key", "fish");
 m1.setBooleanProperty("key", true);
 m1.setStringProperty("key2", "fish");
 m1.setStringProperty("key2", null);
 m1.setStringProperty("key3", "fish");
 m1.setObjectProperty("key3", null);
 queueProducer.send(m1);
 Message m2 = queueConsumer.receive(1000);
 Assert.assertEquals("key should be true", m2.getObjectProperty("key"), Boolean.TRUE);
 Assert.assertEquals("key2 should be null", null, m2.getObjectProperty("key2"));
 Assert.assertEquals("key3 should be null", null, m2.getObjectProperty("key3"));
}

代码示例来源: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");
}

相关文章