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

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

本文整理了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

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

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

  1. /**
  2. * @return Returns the message properties in Map form, useful when encoding to JSON
  3. */
  4. default Map<String, Object> toPropertyMap() {
  5. Map map = new HashMap<>();
  6. for (SimpleString name : getPropertyNames()) {
  7. Object value = getObjectProperty(name.toString());
  8. //some property is SimpleString, which is not available for management console
  9. if (value instanceof SimpleString) {
  10. value = value.toString();
  11. }
  12. map.put(name.toString(), value);
  13. }
  14. return map;
  15. }

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

  1. public static Set<String> getPropertyNames(Message message) {
  2. HashSet<String> set = new HashSet<>();
  3. for (SimpleString propName : message.getPropertyNames()) {
  4. if (propName.equals(Message.HDR_GROUP_ID)) {
  5. set.add(MessageUtil.JMSXGROUPID);
  6. } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
  7. set.add(MessageUtil.JMSXUSERID);
  8. } 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)) {
  9. set.add(propName.toString());
  10. }
  11. }
  12. set.add(JMSXDELIVERYCOUNT);
  13. return set;
  14. }

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

  1. public static void clearProperties(Message message) {
  2. /**
  3. * JavaDoc for this method states:
  4. * Clears a message's properties.
  5. * The message's header fields and body are not cleared.
  6. *
  7. * Since the {@code Message.HDR_ROUTING_TYPE} is used for the JMSDestination header it isn't cleared
  8. */
  9. List<SimpleString> toRemove = new ArrayList<>();
  10. for (SimpleString propName : message.getPropertyNames()) {
  11. if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
  12. propName.startsWith(JMS_)) && !propName.equals(Message.HDR_ROUTING_TYPE)) {
  13. toRemove.add(propName);
  14. }
  15. }
  16. for (SimpleString propName : toRemove) {
  17. message.removeProperty(propName);
  18. }
  19. }

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

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

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

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

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

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

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

  1. public void printMessageProperties(Message message) throws XMLStreamException {
  2. xmlWriter.writeStartElement(XmlDataConstants.PROPERTIES_PARENT);
  3. for (SimpleString key : message.getPropertyNames()) {
  4. Object value = message.getObjectProperty(key);
  5. xmlWriter.writeEmptyElement(XmlDataConstants.PROPERTIES_CHILD);
  6. xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_NAME, key.toString());
  7. xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_VALUE, XmlDataExporterUtil.convertProperty(value));
  8. // Write the property type as an attribute
  9. String propertyType = XmlDataExporterUtil.getPropertyType(value);
  10. if (propertyType != null) {
  11. xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_TYPE, propertyType);
  12. }
  13. }
  14. xmlWriter.writeEndElement(); // end PROPERTIES_PARENT
  15. }

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

  1. /**
  2. * @return Returns the message properties in Map form, useful when encoding to JSON
  3. */
  4. default Map<String, Object> toPropertyMap() {
  5. Map map = new HashMap<>();
  6. for (SimpleString name : getPropertyNames()) {
  7. Object value = getObjectProperty(name.toString());
  8. //some property is SimpleString, which is not available for management console
  9. if (value instanceof SimpleString) {
  10. value = value.toString();
  11. }
  12. map.put(name.toString(), value);
  13. }
  14. return map;
  15. }

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

  1. /**
  2. * @return Returns the message properties in Map form, useful when encoding to JSON
  3. */
  4. default Map<String, Object> toPropertyMap() {
  5. Map map = new HashMap<>();
  6. for (SimpleString name : getPropertyNames()) {
  7. Object value = getObjectProperty(name.toString());
  8. //some property is SimpleString, which is not available for management console
  9. if (value instanceof SimpleString) {
  10. value = value.toString();
  11. }
  12. map.put(name.toString(), value);
  13. }
  14. return map;
  15. }

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

  1. /**
  2. * @return Returns the message properties in Map form, useful when encoding to JSON
  3. */
  4. default Map<String, Object> toPropertyMap() {
  5. Map map = new HashMap<>();
  6. for (SimpleString name : getPropertyNames()) {
  7. Object value = getObjectProperty(name.toString());
  8. //some property is SimpleString, which is not available for management console
  9. if (value instanceof SimpleString) {
  10. value = value.toString();
  11. }
  12. map.put(name.toString(), value);
  13. }
  14. return map;
  15. }

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

  1. public void printMessageProperties(Message message) throws XMLStreamException {
  2. xmlWriter.writeStartElement(XmlDataConstants.PROPERTIES_PARENT);
  3. for (SimpleString key : message.getPropertyNames()) {
  4. Object value = message.getObjectProperty(key);
  5. xmlWriter.writeEmptyElement(XmlDataConstants.PROPERTIES_CHILD);
  6. xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_NAME, key.toString());
  7. xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_VALUE, XmlDataExporterUtil.convertProperty(value));
  8. // Write the property type as an attribute
  9. String propertyType = XmlDataExporterUtil.getPropertyType(value);
  10. if (propertyType != null) {
  11. xmlWriter.writeAttribute(XmlDataConstants.PROPERTY_TYPE, propertyType);
  12. }
  13. }
  14. xmlWriter.writeEndElement(); // end PROPERTIES_PARENT
  15. }

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

  1. /**
  2. * @return Returns the message properties in Map form, useful when encoding to JSON
  3. */
  4. default Map<String, Object> toPropertyMap() {
  5. Map map = new HashMap<>();
  6. for (SimpleString name : getPropertyNames()) {
  7. Object value = getObjectProperty(name.toString());
  8. //some property is SimpleString, which is not available for management console
  9. if (value instanceof SimpleString) {
  10. value = value.toString();
  11. }
  12. map.put(name.toString(), value);
  13. }
  14. return map;
  15. }

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

  1. /**
  2. * @return Returns the message properties in Map form, useful when encoding to JSON
  3. */
  4. default Map<String, Object> toPropertyMap() {
  5. Map map = new HashMap<>();
  6. for (SimpleString name : getPropertyNames()) {
  7. Object value = getObjectProperty(name.toString());
  8. //some property is SimpleString, which is not available for management console
  9. if (value instanceof SimpleString) {
  10. value = value.toString();
  11. }
  12. map.put(name.toString(), value);
  13. }
  14. return map;
  15. }

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

  1. /**
  2. * @return Returns the message properties in Map form, useful when encoding to JSON
  3. */
  4. default Map<String, Object> toPropertyMap() {
  5. Map map = new HashMap<>();
  6. for (SimpleString name : getPropertyNames()) {
  7. Object value = getObjectProperty(name.toString());
  8. //some property is SimpleString, which is not available for management console
  9. if (value instanceof SimpleString) {
  10. value = value.toString();
  11. }
  12. map.put(name.toString(), value);
  13. }
  14. return map;
  15. }

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

  1. public static Set<String> getPropertyNames(Message message) {
  2. HashSet<String> set = new HashSet<>();
  3. for (SimpleString propName : message.getPropertyNames()) {
  4. if (propName.equals(Message.HDR_GROUP_ID)) {
  5. set.add(MessageUtil.JMSXGROUPID);
  6. } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
  7. set.add(MessageUtil.JMSXUSERID);
  8. } 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)) {
  9. set.add(propName.toString());
  10. }
  11. }
  12. set.add(JMSXDELIVERYCOUNT);
  13. return set;
  14. }

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

  1. public static Set<String> getPropertyNames(Message message) {
  2. HashSet<String> set = new HashSet<>();
  3. for (SimpleString propName : message.getPropertyNames()) {
  4. if (propName.equals(Message.HDR_GROUP_ID)) {
  5. set.add(MessageUtil.JMSXGROUPID);
  6. } else if (propName.equals(Message.HDR_GROUP_SEQUENCE)) {
  7. set.add(MessageUtil.JMSXGROUPSEQ);
  8. } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
  9. set.add(MessageUtil.JMSXUSERID);
  10. } 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)) {
  11. set.add(propName.toString());
  12. }
  13. }
  14. set.add(JMSXDELIVERYCOUNT);
  15. return set;
  16. }

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

  1. public static Set<String> getPropertyNames(Message message) {
  2. HashSet<String> set = new HashSet<>();
  3. for (SimpleString propName : message.getPropertyNames()) {
  4. if (propName.equals(Message.HDR_GROUP_ID)) {
  5. set.add(MessageUtil.JMSXGROUPID);
  6. } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
  7. set.add(MessageUtil.JMSXUSERID);
  8. } 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)) {
  9. set.add(propName.toString());
  10. }
  11. }
  12. set.add(JMSXDELIVERYCOUNT);
  13. return set;
  14. }

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

  1. public static Set<String> getPropertyNames(Message message) {
  2. HashSet<String> set = new HashSet<>();
  3. for (SimpleString propName : message.getPropertyNames()) {
  4. if (propName.equals(Message.HDR_GROUP_ID)) {
  5. set.add(MessageUtil.JMSXGROUPID);
  6. } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
  7. set.add(MessageUtil.JMSXUSERID);
  8. } 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)) {
  9. set.add(propName.toString());
  10. }
  11. }
  12. set.add(JMSXDELIVERYCOUNT);
  13. return set;
  14. }

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

  1. public static Set<String> getPropertyNames(Message message) {
  2. HashSet<String> set = new HashSet<>();
  3. for (SimpleString propName : message.getPropertyNames()) {
  4. if (propName.equals(Message.HDR_GROUP_ID)) {
  5. set.add(MessageUtil.JMSXGROUPID);
  6. } else if (propName.equals(Message.HDR_GROUP_SEQUENCE)) {
  7. set.add(MessageUtil.JMSXGROUPSEQ);
  8. } else if (propName.equals(Message.HDR_VALIDATED_USER)) {
  9. set.add(MessageUtil.JMSXUSERID);
  10. } 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)) {
  11. set.add(propName.toString());
  12. }
  13. }
  14. set.add(JMSXDELIVERYCOUNT);
  15. return set;
  16. }

相关文章