2626import feast .proto .serving .ServingServiceGrpc .ServingServiceBlockingStub ;
2727import feast .proto .types .ValueProto ;
2828import io .grpc .CallCredentials ;
29+ import io .grpc .Deadline ;
2930import io .grpc .ManagedChannel ;
3031import io .grpc .ManagedChannelBuilder ;
3132import io .grpc .netty .shaded .io .grpc .netty .GrpcSslContexts ;
@@ -63,7 +64,20 @@ public static FeastClient create(String host, int port) {
6364 }
6465
6566 /**
66- * Create a authenticated client that can access Feast serving with authentication enabled.
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+ */
74+ public static FeastClient create (String host , int port , Deadline deadline ) {
75+ // configure client with no security config.
76+ return FeastClient .createSecure (host , port , SecurityConfig .newBuilder ().build (), deadline );
77+ }
78+
79+ /**
80+ * Create an authenticated client that can access Feast serving with authentication enabled.
6781 *
6882 * @param host hostname or ip address of Feast serving GRPC server
6983 * @param port port number of Feast serving GRPC server
@@ -72,6 +86,21 @@ public static FeastClient create(String host, int port) {
7286 * @return {@link FeastClient}
7387 */
7488 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+ */
102+ public static FeastClient createSecure (
103+ String host , int port , SecurityConfig securityConfig , Deadline deadline ) {
75104 // Configure client TLS
76105 ManagedChannel channel = null ;
77106 if (securityConfig .isTLSEnabled ()) {
@@ -98,7 +127,7 @@ public static FeastClient createSecure(String host, int port, SecurityConfig sec
98127 channel = ManagedChannelBuilder .forAddress (host , port ).usePlaintext ().build ();
99128 }
100129
101- return new FeastClient (channel , securityConfig .getCredentials ());
130+ return new FeastClient (channel , securityConfig .getCredentials (), Optional . ofNullable ( deadline ) );
102131 }
103132
104133 /**
@@ -202,6 +231,11 @@ public List<Row> getOnlineFeatures(List<String> featureRefs, List<Row> rows, Str
202231 }
203232
204233 protected FeastClient (ManagedChannel channel , Optional <CallCredentials > credentials ) {
234+ this (channel , credentials , Optional .empty ());
235+ }
236+
237+ protected FeastClient (
238+ ManagedChannel channel , Optional <CallCredentials > credentials , Optional <Deadline > deadline ) {
205239 this .channel = channel ;
206240 TracingClientInterceptor tracingInterceptor =
207241 TracingClientInterceptor .newBuilder ().withTracer (GlobalTracer .get ()).build ();
@@ -213,6 +247,10 @@ protected FeastClient(ManagedChannel channel, Optional<CallCredentials> credenti
213247 servingStub = servingStub .withCallCredentials (credentials .get ());
214248 }
215249
250+ if (deadline .isPresent ()) {
251+ servingStub = servingStub .withDeadline (deadline .get ());
252+ }
253+
216254 this .stub = servingStub ;
217255 }
218256
0 commit comments