@@ -58,20 +58,47 @@ public class FeastClient implements AutoCloseable {
5858 * @param port port number of Feast serving GRPC server
5959 * @return {@link FeastClient}
6060 */
61+ public static FeastClient create (String host , int port ) {
62+ // configure client with no security config.
63+ return FeastClient .createSecure (host , port , SecurityConfig .newBuilder ().build ());
64+ }
65+
66+ /**
67+ * Create a client to access Feast Serving.
68+ *
69+ * @param host hostname or ip address of Feast serving GRPC server
70+ * @param port port number of Feast serving GRPC server
71+ * @param deadline GRPC deadline of Feast serving GRPC server {@link Deadline}
72+ * @return {@link FeastClient}
73+ */
6174 public static FeastClient create (String host , int port , Deadline deadline ) {
6275 // configure client with no security config.
6376 return FeastClient .createSecure (host , port , SecurityConfig .newBuilder ().build (), deadline );
6477 }
6578
6679 /**
67- * Create a authenticated client that can access Feast serving with authentication enabled.
80+ * Create an authenticated client that can access Feast serving with authentication enabled.
6881 *
6982 * @param host hostname or ip address of Feast serving GRPC server
7083 * @param port port number of Feast serving GRPC server
7184 * @param securityConfig security options to configure the Feast client. See {@link
7285 * SecurityConfig} for options.
7386 * @return {@link FeastClient}
7487 */
88+ public static FeastClient createSecure (String host , int port , SecurityConfig securityConfig ) {
89+ return createSecure (host , port , securityConfig , null );
90+ }
91+
92+ /**
93+ * Create an authenticated client that can access Feast serving with authentication enabled.
94+ *
95+ * @param host hostname or ip address of Feast serving GRPC server
96+ * @param port port number of Feast serving GRPC server
97+ * @param securityConfig security options to configure the Feast client. See {@link
98+ * SecurityConfig} for options.
99+ * @param deadline GRPC deadline of Feast serving GRPC server {@link Deadline}
100+ * @return {@link FeastClient}
101+ */
75102 public static FeastClient createSecure (String host , int port , SecurityConfig securityConfig , Deadline deadline ) {
76103 // Configure client TLS
77104 ManagedChannel channel = null ;
@@ -99,7 +126,7 @@ public static FeastClient createSecure(String host, int port, SecurityConfig sec
99126 channel = ManagedChannelBuilder .forAddress (host , port ).usePlaintext ().build ();
100127 }
101128
102- return new FeastClient (channel , securityConfig .getCredentials (), deadline );
129+ return new FeastClient (channel , securityConfig .getCredentials (), Optional . ofNullable ( deadline ) );
103130 }
104131
105132 /**
@@ -202,7 +229,11 @@ public List<Row> getOnlineFeatures(List<String> featureRefs, List<Row> rows, Str
202229 return getOnlineFeatures (featureRefs , rows );
203230 }
204231
205- protected FeastClient (ManagedChannel channel , Optional <CallCredentials > credentials , Deadline deadline ) {
232+ protected FeastClient (ManagedChannel channel , Optional <CallCredentials > credentials ) {
233+ this (channel , credentials , Optional .empty ());
234+ }
235+
236+ protected FeastClient (ManagedChannel channel , Optional <CallCredentials > credentials , Optional <Deadline > deadline ) {
206237 this .channel = channel ;
207238 TracingClientInterceptor tracingInterceptor =
208239 TracingClientInterceptor .newBuilder ().withTracer (GlobalTracer .get ()).build ();
@@ -214,7 +245,9 @@ protected FeastClient(ManagedChannel channel, Optional<CallCredentials> credenti
214245 servingStub = servingStub .withCallCredentials (credentials .get ());
215246 }
216247
217- servingStub = servingStub .withDeadline (deadline );
248+ if (deadline .isPresent ()) {
249+ servingStub = servingStub .withDeadline (deadline .get ());
250+ }
218251
219252 this .stub = servingStub ;
220253 }
0 commit comments