public static ByteBuf newConnected(int clientProtocolVersion) { CommandConnected.Builder connectedBuilder = CommandConnected.newBuilder(); connectedBuilder.setServerVersion("Pulsar Server"); // If the broker supports a newer version of the protocol, it will anyway advertise the max version that the // client supports, to avoid confusing the client. int currentProtocolVersion = getCurrentProtocolVersion(); int versionToAdvertise = Math.min(currentProtocolVersion, clientProtocolVersion); connectedBuilder.setProtocolVersion(versionToAdvertise); CommandConnected connected = connectedBuilder.build(); ByteBuf res = serializeWithSize(BaseCommand.newBuilder().setType(Type.CONNECTED).setConnected(connected)); connected.recycle(); connectedBuilder.recycle(); return res; }
public static ByteBuf newConnected(int clientProtocolVersion) { CommandConnected.Builder connectedBuilder = CommandConnected.newBuilder(); connectedBuilder.setServerVersion("Pulsar Server"); // If the broker supports a newer version of the protocol, it will anyway advertise the max version that the // client supports, to avoid confusing the client. int currentProtocolVersion = getCurrentProtocolVersion(); int versionToAdvertise = Math.min(currentProtocolVersion, clientProtocolVersion); connectedBuilder.setProtocolVersion(versionToAdvertise); CommandConnected connected = connectedBuilder.build(); ByteBuf res = serializeWithSize(BaseCommand.newBuilder().setType(Type.CONNECTED).setConnected(connected)); connected.recycle(); connectedBuilder.recycle(); return res; }
public Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.CommandConnected other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.CommandConnected.getDefaultInstance()) return this; if (other.hasServerVersion()) { setServerVersion(other.getServerVersion()); } if (other.hasProtocolVersion()) { setProtocolVersion(other.getProtocolVersion()); } return this; }
public Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.CommandConnected other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.CommandConnected.getDefaultInstance()) return this; if (other.hasServerVersion()) { setServerVersion(other.getServerVersion()); } if (other.hasProtocolVersion()) { setProtocolVersion(other.getProtocolVersion()); } return this; }