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

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

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

Message.clearProperties介绍

[英]Clears a message's properties.

The message's header fields and body are not cleared.
[中]清除消息的属性。
消息的标题字段和正文未清除。

代码示例

代码示例来源:origin: openzipkin/brave

static void doFilterProperties(
  Message message, Set<String> namesToClear, ArrayList<Object> retainedProperties
) throws JMSException {
 Enumeration<?> names = message.getPropertyNames();
 while (names.hasMoreElements()) {
  String name = (String) names.nextElement();
  Object value = message.getObjectProperty(name);
  if (!namesToClear.contains(name) && value != null) {
   retainedProperties.add(name);
   retainedProperties.add(value);
  }
 }
 // redo the properties to keep
 message.clearProperties();
 for (int i = 0, length = retainedProperties.size(); i < length; i += 2) {
  message.setObjectProperty(
    retainedProperties.get(i).toString(),
    retainedProperties.get(i + 1)
  );
 }
}

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

public void clearProperties() throws JMSException {
  message.clearProperties();
}

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

@Override
public void clearProperties() throws JMSException {
  message.clearProperties();
}

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

public void clearProperties() throws JMSException
{
 message.clearProperties();
}

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

/**
* Clear properties
* @exception JMSException Thrown if an error occurs
*/
public void clearProperties() throws JMSException
{
 if (_log.isTraceEnabled())
 {
   _log.trace("clearProperties()");
 }
 _message.clearProperties();
}

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

/**
* Clear properties
*
* @throws JMSException Thrown if an error occurs
*/
@Override
public void clearProperties() throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("clearProperties()");
 }
 message.clearProperties();
}

代码示例来源: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.activemq/artemis-ra

/**
* Clear properties
*
* @throws JMSException Thrown if an error occurs
*/
@Override
public void clearProperties() throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("clearProperties()");
 }
 message.clearProperties();
}

代码示例来源: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: apache/activemq-artemis

private static void copyProperties(final Message msg) throws JMSException {
 Enumeration<String> en = msg.getPropertyNames();
 Map<String, Object> oldProps = null;
 while (en.hasMoreElements()) {
   String propName = en.nextElement();
   if (oldProps == null) {
    oldProps = new HashMap<>();
   }
   oldProps.put(propName, msg.getObjectProperty(propName));
 }
 msg.clearProperties();
 if (oldProps != null) {
   for (Entry<String, Object> entry : oldProps.entrySet()) {
    String propName = entry.getKey();
    Object val = entry.getValue();
    if (val instanceof byte[] == false) {
      //Can't set byte[] array props through the JMS API - if we're bridging an ActiveMQ Artemis message it might have such props
      msg.setObjectProperty(propName, entry.getValue());
    } else if (msg instanceof ActiveMQMessage) {
      ((ActiveMQMessage) msg).getCoreMessage().putBytesProperty(propName, (byte[]) val);
    }
   }
 }
}

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

jmsMessage.clearProperties();
for (Entry<String, Object> entry : map.entrySet()) {
  jmsMessage.setObjectProperty(entry.getKey(), entry.getValue());

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

msg.clearProperties();

代码示例来源:origin: org.ballerinalang/ballerina-jms

@Override
  public void execute(Context context, CallableUnitCallback callableUnitCallback) {

    Struct messageStruct = BallerinaAdapter.getReceiverObject(context);
    Message message = BallerinaAdapter.getNativeObject(messageStruct,
                              Constants.JMS_MESSAGE_OBJECT,
                              Message.class,
                              context);
    try {
      message.clearProperties();
    } catch (JMSException e) {
      BallerinaAdapter.returnError("Error when clearing the message properties", context, e);
    }
  }
}

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

msg.clearProperties();

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

@Test
public void testClearMessage() throws Exception {
 queueProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
 Message message = queueProducerSession.createTextMessage("some message");
 queueProducer.send(message);
 message = queueConsumer.receive(1000);
 ProxyAssertSupport.assertNotNull(message);
 message.clearProperties();
 ProxyAssertSupport.assertNotNull(message.getJMSDestination());
}

代码示例来源:origin: org.fusesource.fabric.bridge/fabric-bridge

currentMessage.clearProperties();
setMessageProperties(currentMessage, properties);
properties.clear();

代码示例来源:origin: org.fusesource.fabric.bridge/fabric-bridge

currentMessage.clearProperties();
setMessageProperties(currentMessage, properties);
properties.clear();

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

m2.clearProperties();

相关文章