You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect error handling in ConsumerBase.receiveAsync #249
If the listener is unavailable or state is not ready the function should return exception.
Actual behavior
It doesn't, as seen below the return statement is missing before FutureUtil
@Override
public CompletableFuture<Message> receiveAsync() {
if (listener != null) {
FutureUtil.failedFuture(new PulsarClientException.InvalidConfigurationException(
"Cannot use receive() when a listener has been set"));
}
switch (getState()) {
case Ready:
case Connecting:
break; // Ok
case Closing:
case Closed:
FutureUtil.failedFuture(new PulsarClientException.AlreadyClosedException("Consumer already closed"));
case Failed:
case Uninitialized:
FutureUtil.failedFuture(new PulsarClientException.NotConnectedException());
}
return internalReceiveAsync();
}
Activity
Fix in ConsumerBase.java to return failed future - #249 (#257)