use of com.yahoo.pulsar.common.api.proto.PulsarApi.CommandConnect in project pulsar by yahoo.
the class Commands method newConnect.
public static ByteBuf newConnect(String authMethodName, String authData, int protocolVersion) {
CommandConnect.Builder connectBuilder = CommandConnect.newBuilder();
connectBuilder.setClientVersion("Pulsar Client");
connectBuilder.setAuthMethodName(authMethodName);
if ("ycav1".equals(authMethodName)) {
// Handle the case of a client that gets updated before the broker and starts sending the string auth method
// name. An example would be in broker-to-broker replication. We need to make sure the clients are still
// passing both the enum and the string until all brokers are upgraded.
connectBuilder.setAuthMethod(AuthMethod.AuthMethodYcaV1);
}
connectBuilder.setAuthData(ByteString.copyFromUtf8(authData));
connectBuilder.setProtocolVersion(protocolVersion);
CommandConnect connect = connectBuilder.build();
ByteBuf res = serializeWithSize(BaseCommand.newBuilder().setType(Type.CONNECT).setConnect(connect));
connect.recycle();
connectBuilder.recycle();
return res;
}
use of com.yahoo.pulsar.common.api.proto.PulsarApi.CommandConnect in project pulsar by yahoo.
the class Commands method newConnect.
/**
* @deprecated AuthMethod has been deprecated. Use
* {@link #newConnect(String authMethodName, String authData, int protocolVersion)} instead.
*/
@Deprecated
public static ByteBuf newConnect(AuthMethod authMethod, String authData, int protocolVersion) {
CommandConnect.Builder connectBuilder = CommandConnect.newBuilder();
connectBuilder.setClientVersion("Pulsar Client");
connectBuilder.setAuthMethod(authMethod);
connectBuilder.setAuthData(ByteString.copyFromUtf8(authData));
connectBuilder.setProtocolVersion(protocolVersion);
CommandConnect connect = connectBuilder.build();
ByteBuf res = serializeWithSize(BaseCommand.newBuilder().setType(Type.CONNECT).setConnect(connect));
connect.recycle();
connectBuilder.recycle();
return res;
}
Aggregations