Skip to content

Commit

Permalink
Fix send to deadLetterTopic not working when reach maxRedeliverCount (a…
Browse files Browse the repository at this point in the history
…pache#14317)

If a message reached maxRedeliverCount, it will send to deadLetterTopic, since 2.8.0, this mechanism is broken, it was introduced in apache#9970

(cherry picked from commit 16beb9d)
  • Loading branch information
Shawyeok authored and michaeljmarshall committed Feb 24, 2022
1 parent 20c8a1e commit f1a1294
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,13 @@ public Schema<T> clone() {
* @param schemaVersion the version
* @return the schema at that specific version
* @throws SchemaSerializationException in case of unknown schema version
* @throws NullPointerException in case of null schemaVersion
* @throws NullPointerException in case of null schemaVersion and supportSchemaVersioning is true
*/
public Schema<?> atSchemaVersion(byte[] schemaVersion) throws SchemaSerializationException {
Objects.requireNonNull(schemaVersion);
if (!supportSchemaVersioning()) {
return this;
} else {
throw new SchemaSerializationException("Not implemented for " + this.getClass());
}
Objects.requireNonNull(schemaVersion);
throw new SchemaSerializationException("Not implemented for " + this.getClass());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;

import java.nio.ByteBuffer;
import java.util.Optional;
import org.apache.pulsar.client.api.Message;
import org.apache.pulsar.client.api.Schema;
import org.apache.pulsar.common.api.proto.MessageMetadata;
Expand Down Expand Up @@ -81,4 +81,15 @@ public void testTopicMessageImplNoReplicatedInfo() {
assertFalse(topicMessage.isReplicated());
assertNull(topicMessage.getReplicatedFrom());
}

@Test
public void testMessageImplGetReaderSchema() {
MessageMetadata builder = new MessageMetadata();
builder.hasSchemaVersion();
ByteBuffer payload = ByteBuffer.wrap(new byte[0]);
Message<byte[]> msg = MessageImpl.create(builder, payload, Schema.BYTES);

Optional<Schema<?>> readerSchema = msg.getReaderSchema();
assertTrue(readerSchema.isPresent());
}
}

0 comments on commit f1a1294

Please sign in to comment.