ARTEMIS-3063 AMQPMessage get property can use a String switch
This commit is contained in:
parent
1adf88545f
commit
2e0f051d2d
|
@ -33,11 +33,15 @@ import org.apache.activemq.artemis.api.core.SimpleString;
|
|||
*/
|
||||
public class MessageUtil {
|
||||
|
||||
public static final SimpleString CORRELATIONID_HEADER_NAME = new SimpleString("JMSCorrelationID");
|
||||
public static final String CORRELATIONID_HEADER_NAME_STRING = "JMSCorrelationID";
|
||||
|
||||
public static final SimpleString CORRELATIONID_HEADER_NAME = new SimpleString(CORRELATIONID_HEADER_NAME_STRING);
|
||||
|
||||
public static final SimpleString REPLYTO_HEADER_NAME = new SimpleString("JMSReplyTo");
|
||||
|
||||
public static final SimpleString TYPE_HEADER_NAME = new SimpleString("JMSType");
|
||||
public static final String TYPE_HEADER_NAME_STRING = "JMSType";
|
||||
|
||||
public static final SimpleString TYPE_HEADER_NAME = new SimpleString(TYPE_HEADER_NAME_STRING);
|
||||
|
||||
public static final SimpleString JMS = new SimpleString("JMS");
|
||||
|
||||
|
@ -53,7 +57,9 @@ public class MessageUtil {
|
|||
|
||||
public static final String JMSXUSERID = "JMSXUserID";
|
||||
|
||||
public static final SimpleString CONNECTION_ID_PROPERTY_NAME = new SimpleString("__AMQ_CID");
|
||||
public static final String CONNECTION_ID_PROPERTY_NAME_STRING = "__AMQ_CID";
|
||||
|
||||
public static final SimpleString CONNECTION_ID_PROPERTY_NAME = new SimpleString(CONNECTION_ID_PROPERTY_NAME_STRING);
|
||||
|
||||
// public static ActiveMQBuffer getBodyBuffer(Message message) {
|
||||
// return message.getBodyBuffer();
|
||||
|
|
|
@ -1365,27 +1365,28 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
|
|||
|
||||
@Override
|
||||
public final Object getObjectProperty(String key) {
|
||||
if (key.equals(MessageUtil.TYPE_HEADER_NAME.toString())) {
|
||||
if (properties != null) {
|
||||
return properties.getSubject();
|
||||
}
|
||||
} else if (key.equals(MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString())) {
|
||||
return getConnectionID();
|
||||
} else if (key.equals(MessageUtil.JMSXGROUPID)) {
|
||||
return getGroupID();
|
||||
} else if (key.equals(MessageUtil.JMSXGROUPSEQ)) {
|
||||
return getGroupSequence();
|
||||
} else if (key.equals(MessageUtil.JMSXUSERID)) {
|
||||
return getAMQPUserID();
|
||||
} else if (key.equals(MessageUtil.CORRELATIONID_HEADER_NAME.toString())) {
|
||||
if (properties != null && properties.getCorrelationId() != null) {
|
||||
return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId());
|
||||
}
|
||||
} else {
|
||||
return getApplicationObjectProperty(key);
|
||||
switch (key) {
|
||||
case MessageUtil.TYPE_HEADER_NAME_STRING:
|
||||
if (properties != null) {
|
||||
return properties.getSubject();
|
||||
}
|
||||
return null;
|
||||
case MessageUtil.CONNECTION_ID_PROPERTY_NAME_STRING:
|
||||
return getConnectionID();
|
||||
case MessageUtil.JMSXGROUPID:
|
||||
return getGroupID();
|
||||
case MessageUtil.JMSXGROUPSEQ:
|
||||
return getGroupSequence();
|
||||
case MessageUtil.JMSXUSERID:
|
||||
return getAMQPUserID();
|
||||
case MessageUtil.CORRELATIONID_HEADER_NAME_STRING:
|
||||
if (properties != null && properties.getCorrelationId() != null) {
|
||||
return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId());
|
||||
}
|
||||
return null;
|
||||
default:
|
||||
return getApplicationObjectProperty(key);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object getApplicationObjectProperty(String key) {
|
||||
|
@ -1414,12 +1415,13 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
|
|||
|
||||
@Override
|
||||
public final String getStringProperty(String key) throws ActiveMQPropertyConversionException {
|
||||
if (key.equals(MessageUtil.TYPE_HEADER_NAME.toString())) {
|
||||
return properties.getSubject();
|
||||
} else if (key.equals(MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString())) {
|
||||
return getConnectionID();
|
||||
} else {
|
||||
return (String) getApplicationPropertiesMap(false).get(key);
|
||||
switch (key) {
|
||||
case MessageUtil.TYPE_HEADER_NAME_STRING:
|
||||
return properties.getSubject();
|
||||
case MessageUtil.CONNECTION_ID_PROPERTY_NAME_STRING:
|
||||
return getConnectionID();
|
||||
default:
|
||||
return (String) getApplicationPropertiesMap(false).get(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue