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

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

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

Message.getObjectProperty介绍

暂无

代码示例

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

public static byte[] getJMSCorrelationIDAsBytes(Message message) {
 Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME);
 if (obj instanceof byte[]) {
   return (byte[]) obj;
 } else {
   return null;
 }
}

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

public static byte[] getJMSCorrelationIDAsBytes(Message message) {
 Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME);
 if (obj instanceof byte[]) {
   return (byte[]) obj;
 } else {
   return null;
 }
}

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

public static byte[] getJMSCorrelationIDAsBytes(Message message) {
 Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME);
 if (obj instanceof byte[]) {
   return (byte[]) obj;
 } else {
   return null;
 }
}

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

public static byte[] getJMSCorrelationIDAsBytes(Message message) {
 Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME);
 if (obj instanceof byte[]) {
   return (byte[]) obj;
 } else {
   return null;
 }
}

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

public static byte[] getJMSCorrelationIDAsBytes(Message message) {
 Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME);
 if (obj instanceof byte[]) {
   return (byte[]) obj;
 } else {
   return null;
 }
}

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

public static byte[] getJMSCorrelationIDAsBytes(Message message) {
 Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME);
 if (obj instanceof byte[]) {
   return (byte[]) obj;
 } else {
   return null;
 }
}

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

public static byte[] getJMSCorrelationIDAsBytes(Message message) {
 Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME);
 if (obj instanceof byte[]) {
   return (byte[]) obj;
 } else {
   return null;
 }
}

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

private void internalComputeMessage(Map<String, Long> result, Filter filter, SimpleString groupByProperty, Message message) {
 if (filter == null || filter.match(message)) {
   if (groupByProperty == null) {
    result.compute(null, (k, v) -> v == null ? 1 : ++v);
   } else {
    Object value = message.getObjectProperty(groupByProperty);
    String valueStr = value == null ? null : value.toString();
    result.compute(valueStr, (k, v) -> v == null ? 1 : ++v);
   }
 }
}

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

public static Object getObjectProperty(final Message message, final String name) {
 final Object val;
 if (MessageUtil.JMSXGROUPID.equals(name)) {
   val = message.getGroupID();
 } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
   val = message.getGroupSequence();
 } else if (MessageUtil.JMSXUSERID.equals(name)) {
   val = message.getValidatedUserID();
 } else {
   val = message.getObjectProperty(name);
 }
 if (val instanceof SimpleString) {
   return val.toString();
 }
 return val;
}

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

public static Object getObjectProperty(final Message message, final String name) {
 final Object val;
 if (MessageUtil.JMSXGROUPID.equals(name)) {
   val = message.getGroupID();
 } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
   val = message.getGroupSequence();
 } else if (MessageUtil.JMSXUSERID.equals(name)) {
   val = message.getValidatedUserID();
 } else {
   val = message.getObjectProperty(name);
 }
 if (val instanceof SimpleString) {
   return val.toString();
 }
 return val;
}

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

@Override
public boolean match(final Message message) {
 if (headerName != null) {
   Object value = message.getObjectProperty(headerName);
   if (value instanceof SimpleString) {
    value = ((SimpleString) value).toString();
   }
   if (value != null && headerValue.equals(value)) {
    return true;
   }
   return false;
 }
 return true;
}

相关文章

微信公众号

最新文章

更多