use of org.apache.pulsar.common.api.proto.CommandTcClientConnectRequest in project pulsar by apache.
the class ServerCnx method handleTcClientConnectRequest.
@Override
protected void handleTcClientConnectRequest(CommandTcClientConnectRequest command) {
final long requestId = command.getRequestId();
final TransactionCoordinatorID tcId = TransactionCoordinatorID.get(command.getTcId());
if (log.isDebugEnabled()) {
log.debug("Receive tc client connect request {} to transaction meta store {} from {}.", requestId, tcId, remoteAddress);
}
if (!checkTransactionEnableAndSendError(requestId)) {
return;
}
TransactionMetadataStoreService transactionMetadataStoreService = service.pulsar().getTransactionMetadataStoreService();
transactionMetadataStoreService.handleTcClientConnect(tcId).thenAccept(connection -> {
if (log.isDebugEnabled()) {
log.debug("Handle tc client connect request {} to transaction meta store {} from {} success.", requestId, tcId, remoteAddress);
}
commandSender.sendTcClientConnectResponse(requestId);
}).exceptionally(e -> {
log.error("Handle tc client connect request {} to transaction meta store {} from {} fail.", requestId, tcId, remoteAddress, e.getCause());
commandSender.sendTcClientConnectResponse(requestId, BrokerServiceException.getClientErrorCode(e), e.getMessage());
return null;
});
}
Aggregations