RobertIndie commented on code in PR #15051:
URL: https://github.com/apache/pulsar/pull/15051#discussion_r844808216
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -992,32 +992,24 @@ protected void handleSubscribe(final CommandSubscribe
subscribe) {
}
if (existingConsumerFuture != null) {
- if (existingConsumerFuture.isDone() &&
!existingConsumerFuture.isCompletedExceptionally()) {
+ if (!existingConsumerFuture.isDone()){
+ log.warn("[{}][{}][{}] Consumer with id is already
present on the connection,"
+ + " consumerId={}", remoteAddress, topicName,
subscriptionName, consumerId);
+ commandSender.sendErrorResponse(requestId,
ServerError.ServiceNotReady,
+ "Consumer is already present on the
connection");
+ } else if
(existingConsumerFuture.isCompletedExceptionally()){
+ ServerError error =
getErrorCode(existingConsumerFuture);
+ consumers.remove(consumerId, existingConsumerFuture);
+ commandSender.sendErrorResponse(requestId, error,
+ "Last subscribe failure, please try again.");
+ } else {
Consumer consumer =
existingConsumerFuture.getNow(null);
log.info("[{}] Consumer with the same id is already
created:"
- + " consumerId={}, consumer={}",
- remoteAddress, consumerId, consumer);
+ + " consumerId={}, consumer={}",
+ remoteAddress, consumerId, consumer);
commandSender.sendSuccessResponse(requestId);
- return null;
- } else {
- // There was an early request to create a consumer
with same consumerId. This can happen
Review Comment:
Why do we delete these comments?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]