org.apache.activemq.artemis.api.core.Message.getPropertyNames()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(131)

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

Message.getPropertyNames介绍

[英]Returns all the names of the properties for this message.
[中]返回此消息的所有属性名称。

代码示例

代码示例来源:origin: wildfly/wildfly

private static void replaceDict(final Message message, Map<SimpleString, SimpleString> dictionary) {
 for (SimpleString property : new HashSet<>(message.getPropertyNames())) {
   SimpleString replaceTo = dictionary.get(property);
   if (replaceTo != null) {
    message.putObjectProperty(replaceTo, message.removeProperty(property));
   }
 }
}

代码示例来源:origin: wildfly/wildfly

/**
* @return Returns the message properties in Map form, useful when encoding to JSON
*/
default Map<String, Object> toPropertyMap() {
 Map map = new HashMap<>();
 for (SimpleString name : getPropertyNames()) {
   Object value = getObjectProperty(name.toString());
   //some property is SimpleString, which is not available for management console
   if (value instanceof SimpleString) {
    value = value.toString();
   }
   map.put(name.toString(), value);
 }
 return map;
}

代码示例来源:origin: wildfly/wildfly

public static Set<String> getPropertyNames(Message message) {
 HashSet<String> set = new HashSet<>();
 for (SimpleString propName : message.getPropertyNames()) {
   if (propName.equals(Message.HDR_GROUP_ID)) {
    set.add(MessageUtil.JMSXGROUPID);
   } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
    set.add(MessageUtil.JMSXUSERID);
   } else if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME) && !propName.equals(Message.HDR_ROUTING_TYPE) && !propName.startsWith(Message.HDR_ROUTE_TO_IDS)) {
    set.add(propName.toString());
   }
 }
 set.add(JMSXDELIVERYCOUNT);
 return set;
}

代码示例来源:origin: wildfly/wildfly

public static void clearProperties(Message message) {
 /**
  * JavaDoc for this method states:
  *    Clears a message's properties.
  *    The message's header fields and body are not cleared.
  *
  * Since the {@code Message.HDR_ROUTING_TYPE} is used for the JMSDestination header it isn't cleared
  */
 List<SimpleString> toRemove = new ArrayList<>();
 for (SimpleString propName : message.getPropertyNames()) {
   if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
    propName.startsWith(JMS_)) && !propName.equals(Message.HDR_ROUTING_TYPE)) {
    toRemove.add(propName);
   }
 }
 for (SimpleString propName : toRemove) {
   message.removeProperty(propName);
 }
}

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

private static void replaceDict(final Message message, Map<SimpleString, SimpleString> dictionary) {
 for (SimpleString property : new HashSet<>(message.getPropertyNames())) {
   SimpleString replaceTo = dictionary.get(property);
   if (replaceTo != null) {
    message.putObjectProperty(replaceTo, message.removeProperty(property));
   }
 }
}

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

private static void replaceDict(final Message message, Map<SimpleString, SimpleString> dictionary) {
 for (SimpleString property : new HashSet<>(message.getPropertyNames())) {
   SimpleString replaceTo = dictionary.get(property);
   if (replaceTo != null) {
    message.putObjectProperty(replaceTo, message.removeProperty(property));
   }
 }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private static void replaceDict(final Message message, Map<SimpleString, SimpleString> dictionary) {
 for (SimpleString property : new HashSet<>(message.getPropertyNames())) {
   SimpleString replaceTo = dictionary.get(property);
   if (replaceTo != null) {
    message.putObjectProperty(replaceTo, message.removeProperty(property));
   }
 }
}

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

public void printMessageProperties(Message message) throws XMLStreamException {
 xmlWriter.writeStartElement(XmlDataConstants.PROPERTIES_PARENT);
 for (SimpleString key : message.getPropertyNames()) {
   Object value = message.getObjectProperty(key);
   xmlWriter.writeEmptyElement(XmlDataConstants.PROPERTIES_CHILD);
   xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_NAME, key.toString());
   xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_VALUE, XmlDataExporterUtil.convertProperty(value));
   // Write the property type as an attribute
   String propertyType = XmlDataExporterUtil.getPropertyType(value);
   if (propertyType != null) {
    xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_TYPE, propertyType);
   }
 }
 xmlWriter.writeEndElement(); // end PROPERTIES_PARENT
}

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

/**
* @return Returns the message properties in Map form, useful when encoding to JSON
*/
default Map<String, Object> toPropertyMap() {
 Map map = new HashMap<>();
 for (SimpleString name : getPropertyNames()) {
   Object value = getObjectProperty(name.toString());
   //some property is SimpleString, which is not available for management console
   if (value instanceof SimpleString) {
    value = value.toString();
   }
   map.put(name.toString(), value);
 }
 return map;
}

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

/**
* @return Returns the message properties in Map form, useful when encoding to JSON
*/
default Map<String, Object> toPropertyMap() {
 Map map = new HashMap<>();
 for (SimpleString name : getPropertyNames()) {
   Object value = getObjectProperty(name.toString());
   //some property is SimpleString, which is not available for management console
   if (value instanceof SimpleString) {
    value = value.toString();
   }
   map.put(name.toString(), value);
 }
 return map;
}

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

/**
* @return Returns the message properties in Map form, useful when encoding to JSON
*/
default Map<String, Object> toPropertyMap() {
 Map map = new HashMap<>();
 for (SimpleString name : getPropertyNames()) {
   Object value = getObjectProperty(name.toString());
   //some property is SimpleString, which is not available for management console
   if (value instanceof SimpleString) {
    value = value.toString();
   }
   map.put(name.toString(), value);
 }
 return map;
}

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

public void printMessageProperties(Message message) throws XMLStreamException {
 xmlWriter.writeStartElement(XmlDataConstants.PROPERTIES_PARENT);
 for (SimpleString key : message.getPropertyNames()) {
   Object value = message.getObjectProperty(key);
   xmlWriter.writeEmptyElement(XmlDataConstants.PROPERTIES_CHILD);
   xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_NAME, key.toString());
   xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_VALUE, XmlDataExporterUtil.convertProperty(value));
   // Write the property type as an attribute
   String propertyType = XmlDataExporterUtil.getPropertyType(value);
   if (propertyType != null) {
    xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_TYPE, propertyType);
   }
 }
 xmlWriter.writeEndElement(); // end PROPERTIES_PARENT
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

/**
* @return Returns the message properties in Map form, useful when encoding to JSON
*/
default Map<String, Object> toPropertyMap() {
 Map map = new HashMap<>();
 for (SimpleString name : getPropertyNames()) {
   Object value = getObjectProperty(name.toString());
   //some property is SimpleString, which is not available for management console
   if (value instanceof SimpleString) {
    value = value.toString();
   }
   map.put(name.toString(), value);
 }
 return map;
}

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

/**
* @return Returns the message properties in Map form, useful when encoding to JSON
*/
default Map<String, Object> toPropertyMap() {
 Map map = new HashMap<>();
 for (SimpleString name : getPropertyNames()) {
   Object value = getObjectProperty(name.toString());
   //some property is SimpleString, which is not available for management console
   if (value instanceof SimpleString) {
    value = value.toString();
   }
   map.put(name.toString(), value);
 }
 return map;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
* @return Returns the message properties in Map form, useful when encoding to JSON
*/
default Map<String, Object> toPropertyMap() {
 Map map = new HashMap<>();
 for (SimpleString name : getPropertyNames()) {
   Object value = getObjectProperty(name.toString());
   //some property is SimpleString, which is not available for management console
   if (value instanceof SimpleString) {
    value = value.toString();
   }
   map.put(name.toString(), value);
 }
 return map;
}

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

public static Set<String> getPropertyNames(Message message) {
 HashSet<String> set = new HashSet<>();
 for (SimpleString propName : message.getPropertyNames()) {
   if (propName.equals(Message.HDR_GROUP_ID)) {
    set.add(MessageUtil.JMSXGROUPID);
   } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
    set.add(MessageUtil.JMSXUSERID);
   } else if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME) && !propName.equals(Message.HDR_ROUTING_TYPE) && !propName.startsWith(Message.HDR_ROUTE_TO_IDS)) {
    set.add(propName.toString());
   }
 }
 set.add(JMSXDELIVERYCOUNT);
 return set;
}

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

public static Set<String> getPropertyNames(Message message) {
 HashSet<String> set = new HashSet<>();
 for (SimpleString propName : message.getPropertyNames()) {
   if (propName.equals(Message.HDR_GROUP_ID)) {
    set.add(MessageUtil.JMSXGROUPID);
   } else if (propName.equals(Message.HDR_GROUP_SEQUENCE)) {
    set.add(MessageUtil.JMSXGROUPSEQ);
   } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
    set.add(MessageUtil.JMSXUSERID);
   } else if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME) && !propName.equals(Message.HDR_ROUTING_TYPE) && !propName.startsWith(Message.HDR_ROUTE_TO_IDS)) {
    set.add(propName.toString());
   }
 }
 set.add(JMSXDELIVERYCOUNT);
 return set;
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

public static Set<String> getPropertyNames(Message message) {
 HashSet<String> set = new HashSet<>();
 for (SimpleString propName : message.getPropertyNames()) {
   if (propName.equals(Message.HDR_GROUP_ID)) {
    set.add(MessageUtil.JMSXGROUPID);
   } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
    set.add(MessageUtil.JMSXUSERID);
   } else if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME) && !propName.equals(Message.HDR_ROUTING_TYPE) && !propName.startsWith(Message.HDR_ROUTE_TO_IDS)) {
    set.add(propName.toString());
   }
 }
 set.add(JMSXDELIVERYCOUNT);
 return set;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public static Set<String> getPropertyNames(Message message) {
 HashSet<String> set = new HashSet<>();
 for (SimpleString propName : message.getPropertyNames()) {
   if (propName.equals(Message.HDR_GROUP_ID)) {
    set.add(MessageUtil.JMSXGROUPID);
   } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
    set.add(MessageUtil.JMSXUSERID);
   } else if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME) && !propName.equals(Message.HDR_ROUTING_TYPE) && !propName.startsWith(Message.HDR_ROUTE_TO_IDS)) {
    set.add(propName.toString());
   }
 }
 set.add(JMSXDELIVERYCOUNT);
 return set;
}

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

public static Set<String> getPropertyNames(Message message) {
 HashSet<String> set = new HashSet<>();
 for (SimpleString propName : message.getPropertyNames()) {
   if (propName.equals(Message.HDR_GROUP_ID)) {
    set.add(MessageUtil.JMSXGROUPID);
   } else if (propName.equals(Message.HDR_GROUP_SEQUENCE)) {
    set.add(MessageUtil.JMSXGROUPSEQ);
   } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
    set.add(MessageUtil.JMSXUSERID);
   } else if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME) && !propName.equals(Message.HDR_ROUTING_TYPE) && !propName.startsWith(Message.HDR_ROUTE_TO_IDS)) {
    set.add(propName.toString());
   }
 }
 set.add(JMSXDELIVERYCOUNT);
 return set;
}

相关文章

微信公众号

最新文章

更多