gaborgsomogyi commented on a change in pull request #16463:
URL: https://github.com/apache/flink/pull/16463#discussion_r682345714



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/InboundChannelHandlerFactory.java
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.io.network.netty;
+
+import org.apache.flink.annotation.Experimental;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.util.ConfigurationException;
+
+import org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler;
+
+import java.util.Map;
+
+/**
+ * Custom netty inbound handler factory in order to make custom changes on 
netty inbound data. Good
+ * example usage of this API is custom authentication. When the user is not 
authenticated then the
+ * instantiated channel handler can send back 401 to trigger negotiation. 
Since implementations are
+ * loaded with service loader it's discouraged to store any internal state in 
factories.
+ */
+@Experimental
+public interface InboundChannelHandlerFactory {
+    /**
+     * Gives back priority of the {@link ChannelHandler}. The bigger the value 
is, the earlier it is
+     * executed. If multiple handlers have the same priority then the order is 
not defined.
+     *
+     * @return the priority of the {@link ChannelHandler}.
+     */
+    int priority();
+
+    /**
+     * Creates new instance of {@link ChannelHandler}
+     *
+     * @param configuration The Flink {@link Configuration}.
+     * @param responseHeaders The response headers.
+     * @return {@link ChannelHandler} or null if no custom handler need to be 
created.
+     * @throws ConfigurationException Thrown, if the handler configuration is 
incorrect.
+     */
+    ChannelHandler createHandler(Configuration configuration, Map<String, 
String> responseHeaders)

Review comment:
       Changed.

##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/OutboundChannelHandlerFactory.java
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.io.network.netty;
+
+import org.apache.flink.annotation.Experimental;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.util.ConfigurationException;
+
+import org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler;
+
+/**
+ * Custom netty outbound handler factory in order to make custom changes on 
netty outbound data.
+ * Good example usage of this API is custom authentication. When the user 
wants to send
+ * authentication information then the instantiated channel handler can modify 
the HTTP request.
+ * Since implementations are loaded with service loader it's discouraged to 
store any internal state
+ * in factories.
+ */
+@Experimental
+public interface OutboundChannelHandlerFactory {
+    /**
+     * Gives back priority of the {@link ChannelHandler}. The bigger the value 
is, the earlier it is
+     * executed. If multiple handlers have the same priority then the order is 
not defined.
+     *
+     * @return the priority of the {@link ChannelHandler}.
+     */
+    int priority();
+
+    /**
+     * Creates new instance of {@link ChannelHandler}
+     *
+     * @param configuration The Flink {@link Configuration}.
+     * @return {@link ChannelHandler} or null if no custom handler needs to be 
created.
+     * @throws ConfigurationException Thrown, if the handler configuration is 
incorrect.
+     */
+    ChannelHandler createHandler(Configuration configuration) throws 
ConfigurationException;

Review comment:
       Changed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to