liudezhi2098 opened a new pull request #6825:
URL: https://github.com/apache/pulsar/pull/6825
Master Issue: #6824
## Motivation
When sending messages asynchronously fails, an exception will be thrown, but
it is not known which message is abnormal, and the user does not know which
messages need to be retried。
## Modifications
This change can be supported on the client side, when throwing an
exception need to set sequenceId
org.apache.pulsar.client.api.PulsarClientException
```java
public class PulsarClientException extends IOException {
private long sequenceId = -1;
public PulsarClientException(String msg, long sequenceId) {
super(msg);
this.sequenceId = sequenceId;
}
```
Client examples
```java
producer.newMessage().sequenceId(1).value(value.getBytes())
.sendAsync().thenAccept(msgId -> {
System.out.println(msgId);
}).exceptionally(ex -> {
System.out.println(
((PulsarClientException)ex.getCause()).getSequenceId());
return null;
});
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]