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 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 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");
|
public static final SimpleString JMS = new SimpleString("JMS");
|
||||||
|
|
||||||
|
@ -53,7 +57,9 @@ public class MessageUtil {
|
||||||
|
|
||||||
public static final String JMSXUSERID = "JMSXUserID";
|
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) {
|
// public static ActiveMQBuffer getBodyBuffer(Message message) {
|
||||||
// return message.getBodyBuffer();
|
// return message.getBodyBuffer();
|
||||||
|
|
|
@ -1365,27 +1365,28 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Object getObjectProperty(String key) {
|
public final Object getObjectProperty(String key) {
|
||||||
if (key.equals(MessageUtil.TYPE_HEADER_NAME.toString())) {
|
switch (key) {
|
||||||
if (properties != null) {
|
case MessageUtil.TYPE_HEADER_NAME_STRING:
|
||||||
return properties.getSubject();
|
if (properties != null) {
|
||||||
}
|
return properties.getSubject();
|
||||||
} else if (key.equals(MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString())) {
|
}
|
||||||
return getConnectionID();
|
return null;
|
||||||
} else if (key.equals(MessageUtil.JMSXGROUPID)) {
|
case MessageUtil.CONNECTION_ID_PROPERTY_NAME_STRING:
|
||||||
return getGroupID();
|
return getConnectionID();
|
||||||
} else if (key.equals(MessageUtil.JMSXGROUPSEQ)) {
|
case MessageUtil.JMSXGROUPID:
|
||||||
return getGroupSequence();
|
return getGroupID();
|
||||||
} else if (key.equals(MessageUtil.JMSXUSERID)) {
|
case MessageUtil.JMSXGROUPSEQ:
|
||||||
return getAMQPUserID();
|
return getGroupSequence();
|
||||||
} else if (key.equals(MessageUtil.CORRELATIONID_HEADER_NAME.toString())) {
|
case MessageUtil.JMSXUSERID:
|
||||||
if (properties != null && properties.getCorrelationId() != null) {
|
return getAMQPUserID();
|
||||||
return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId());
|
case MessageUtil.CORRELATIONID_HEADER_NAME_STRING:
|
||||||
}
|
if (properties != null && properties.getCorrelationId() != null) {
|
||||||
} else {
|
return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId());
|
||||||
return getApplicationObjectProperty(key);
|
}
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
return getApplicationObjectProperty(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getApplicationObjectProperty(String key) {
|
private Object getApplicationObjectProperty(String key) {
|
||||||
|
@ -1414,12 +1415,13 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String getStringProperty(String key) throws ActiveMQPropertyConversionException {
|
public final String getStringProperty(String key) throws ActiveMQPropertyConversionException {
|
||||||
if (key.equals(MessageUtil.TYPE_HEADER_NAME.toString())) {
|
switch (key) {
|
||||||
return properties.getSubject();
|
case MessageUtil.TYPE_HEADER_NAME_STRING:
|
||||||
} else if (key.equals(MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString())) {
|
return properties.getSubject();
|
||||||
return getConnectionID();
|
case MessageUtil.CONNECTION_ID_PROPERTY_NAME_STRING:
|
||||||
} else {
|
return getConnectionID();
|
||||||
return (String) getApplicationPropertiesMap(false).get(key);
|
default:
|
||||||
|
return (String) getApplicationPropertiesMap(false).get(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue