private void sendPartitionMetadataResponse(CommandPartitionedTopicMetadata partitionMetadata) { final long requestId = partitionMetadata.getRequestId(); TopicName topicName = TopicName.get(partitionMetadata.getTopic()); service.getDiscoveryProvider() .getPartitionedTopicMetadata(service, topicName, authRole, authenticationData) .thenAccept(metadata -> { if (LOG.isDebugEnabled()) { LOG.debug("[{}] Total number of partitions for topic {} is {}", authRole, topicName, metadata.partitions); } ctx.writeAndFlush(Commands.newPartitionMetadataResponse(metadata.partitions, requestId)); }).exceptionally(ex -> { LOG.warn("[{}] Failed to get partitioned metadata for topic {} {}", remoteAddress, topicName, ex.getMessage(), ex); ctx.writeAndFlush( Commands.newPartitionMetadataResponse(ServerError.ServiceNotReady, ex.getMessage(), requestId)); return null; }); }
public void handlePartitionMetadataResponse(CommandPartitionedTopicMetadata partitionMetadata) { partitionsMetadataRequests.inc(); if (log.isDebugEnabled()) { log.debug("[{}] Received PartitionMetadataLookup", clientAddress); } final long clientRequestId = partitionMetadata.getRequestId(); if (this.service.getLookupRequestSemaphore().tryAcquire()) { handlePartitionMetadataResponse(partitionMetadata, clientRequestId); this.service.getLookupRequestSemaphore().release(); } else { rejectedPartitionsMetadataRequests.inc(); if (log.isDebugEnabled()) { log.debug("PartitionMetaData Request ID {} from {} rejected - {}.", clientRequestId, clientAddress, throttlingErrorMessage); } proxyConnection.ctx().writeAndFlush(Commands.newPartitionMetadataResponse(ServerError.ServiceNotReady, throttlingErrorMessage, clientRequestId)); } }
@Override protected void handlePartitionMetadataRequest(CommandPartitionedTopicMetadata partitionMetadata) { final long requestId = partitionMetadata.getRequestId(); if (log.isDebugEnabled()) { log.debug("[{}] Received PartitionMetadataLookup from {} for {}", partitionMetadata.getTopic(),
public Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.CommandPartitionedTopicMetadata other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.CommandPartitionedTopicMetadata.getDefaultInstance()) return this; if (other.hasTopic()) { setTopic(other.getTopic()); } if (other.hasRequestId()) { setRequestId(other.getRequestId()); } if (other.hasOriginalPrincipal()) { setOriginalPrincipal(other.getOriginalPrincipal()); } if (other.hasOriginalAuthData()) { setOriginalAuthData(other.getOriginalAuthData()); } if (other.hasOriginalAuthMethod()) { setOriginalAuthMethod(other.getOriginalAuthMethod()); } return this; }
public Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.CommandPartitionedTopicMetadata other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.CommandPartitionedTopicMetadata.getDefaultInstance()) return this; if (other.hasTopic()) { setTopic(other.getTopic()); } if (other.hasRequestId()) { setRequestId(other.getRequestId()); } if (other.hasOriginalPrincipal()) { setOriginalPrincipal(other.getOriginalPrincipal()); } if (other.hasOriginalAuthData()) { setOriginalAuthData(other.getOriginalAuthData()); } if (other.hasOriginalAuthMethod()) { setOriginalAuthMethod(other.getOriginalAuthMethod()); } return this; }