You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/11/01 12:09:54 UTC
[GitHub] [pulsar] codelipenghui commented on a diff in pull request #15594: [improve][client] Throw more meaningful derived exception instead of PulsarClientException
codelipenghui commented on code in PR #15594:
URL: https://github.com/apache/pulsar/pull/15594#discussion_r1010357093
##########
pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java:
##########
@@ -243,4 +249,74 @@ public void testDontCheckForPartitionsUpdatesOnNonPartitionedTopics() throws Exc
verify(clientMock, times(3)).getPartitionedTopicMetadata(any());
}
+ @Test
+ public void testReconsumeLaterWhenRetryDisabled() {
+ MultiTopicsConsumerImpl<byte[]> consumer = createMultiTopicsConsumer();
+
+ MessageId messageId = new TopicMessageIdImpl("topic-partition-1", "topic",
+ new MessageIdImpl(0, 0, 0));
+ ByteBuffer payload = ByteBuffer.wrap(new byte[0]);
+ MessageImpl<?> msg = MessageImpl.create(new MessageMetadata(), payload, Schema.BYTES, null);
+ msg.setMessageId(messageId);
+ Throwable cause1 = null;
+ try {
+ consumer.reconsumeLater(msg, null, 1, TimeUnit.MINUTES);
+ } catch (PulsarClientException e) {
+ cause1 = e;
+ }
+ assertNotNull(cause1);
+ assertEquals(cause1.getClass(), PulsarClientException.NotSupportedException.class);
Review Comment:
Can simplify with
```java
try {
consumer.reconsumeLater(msg, null, 1, TimeUnit.MINUTES);
fail("Should failed with PulsarClientException.NotSupportedException")
} catch (PulsarClientException.NotSupportedException e) {
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org