ARTEMIS-2766 Not parsing application properties for duplicate property
This commit is contained in:
parent
d9caf839bd
commit
8562e6a1a7
|
@ -116,6 +116,10 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
|
|||
AMQPMessageSymbolSearch.kmpNeedleOf(AMQPMessageSupport.SCHEDULED_DELIVERY_TIME),
|
||||
AMQPMessageSymbolSearch.kmpNeedleOf(AMQPMessageSupport.SCHEDULED_DELIVERY_DELAY)};
|
||||
|
||||
private static final KMPNeedle[] DUPLICATE_ID_NEEDLES = new KMPNeedle[] {
|
||||
AMQPMessageSymbolSearch.kmpNeedleOf(org.apache.activemq.artemis.api.core.Message.HDR_DUPLICATE_DETECTION_ID.toString())
|
||||
};
|
||||
|
||||
public static final int DEFAULT_MESSAGE_FORMAT = 0;
|
||||
public static final int DEFAULT_MESSAGE_PRIORITY = 4;
|
||||
public static final int MAX_MESSAGE_PRIORITY = 9;
|
||||
|
@ -1015,6 +1019,13 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
|
|||
|
||||
@Override
|
||||
public final Object getDuplicateProperty() {
|
||||
|
||||
if (applicationProperties == null) {
|
||||
if (!AMQPMessageSymbolSearch.anyApplicationProperties(getData(), DUPLICATE_ID_NEEDLES)) {
|
||||
// no need for duplicate-property
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return getObjectProperty(org.apache.activemq.artemis.api.core.Message.HDR_DUPLICATE_DETECTION_ID);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,20 @@ final class AMQPMessageSymbolSearch {
|
|||
return KMPNeedle.of(symbol.toString().getBytes(StandardCharsets.US_ASCII));
|
||||
}
|
||||
|
||||
public static boolean anyMessageAnnotations(ReadableBuffer data, KMPNeedle[] needles) {
|
||||
public static KMPNeedle kmpNeedleOf(String symbol) {
|
||||
return KMPNeedle.of(symbol.getBytes(StandardCharsets.US_ASCII));
|
||||
}
|
||||
|
||||
|
||||
public static boolean anyMessageAnnotations(final ReadableBuffer data, final KMPNeedle[] needles) {
|
||||
return lookupOnSection(MessageAnnotations.class, data, needles);
|
||||
}
|
||||
|
||||
public static boolean anyApplicationProperties(final ReadableBuffer data, final KMPNeedle[] needles) {
|
||||
return lookupOnSection(ApplicationProperties.class, data, needles);
|
||||
}
|
||||
|
||||
private static boolean lookupOnSection(final Class section, final ReadableBuffer data, final KMPNeedle[] needles) {
|
||||
DecoderImpl decoder = TLSEncode.getDecoder();
|
||||
final int position = data.position();
|
||||
decoder.setBuffer(data.rewind());
|
||||
|
@ -61,7 +74,7 @@ final class AMQPMessageSymbolSearch {
|
|||
TypeConstructor<?> constructor = decoder.readConstructor();
|
||||
final Class<?> typeClass = constructor.getTypeClass();
|
||||
if (MSG_BODY_TYPES.containsKey(typeClass)) {
|
||||
if (MessageAnnotations.class.equals(typeClass)) {
|
||||
if (section.equals(typeClass)) {
|
||||
final int start = data.position();
|
||||
constructor.skipValue();
|
||||
final int end = data.position();
|
||||
|
|
Loading…
Reference in New Issue