You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/02/09 14:55:19 UTC

[GitHub] [kafka] tombentley commented on a change in pull request #11642: MINOR: Improve Connect docs

tombentley commented on a change in pull request #11642:
URL: https://github.com/apache/kafka/pull/11642#discussion_r802748846



##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/tools/PredicateDoc.java
##########
@@ -61,7 +61,7 @@ private static void printPredicateHtml(PrintStream out, DocInfo docInfo) {
         out.println("<div id=\"" + docInfo.predicateName + "\">");
 
         out.print("<h5>");
-        out.print(docInfo.predicateName);
+        out.print("<a href=\"#" + docInfo.predicateName + "\">" + docInfo.predicateName + "</a>");

Review comment:
       Are this really `href` not `name`? If so what are they linking to?

##########
File path: docs/connect.html
##########
@@ -414,53 +403,49 @@ <h5><a id="connect_connectorexample" href="#connect_connectorexample">Connector
     <p>We'll cover the <code>SourceConnector</code> as a simple example. <code>SinkConnector</code> implementations are very similar. Start by creating the class that inherits from <code>SourceConnector</code> and add a couple of fields that will store parsed configuration information (the filename to read from and the topic to send data to):</p>
 
     <pre class="brush: java;">
-    public class FileStreamSourceConnector extends SourceConnector {
-        private String filename;
-        private String topic;
-    </pre>
+public class FileStreamSourceConnector extends SourceConnector {
+    private String filename;
+    private String topic;</pre>
 
     <p>The easiest method to fill in is <code>taskClass()</code>, which defines the class that should be instantiated in worker processes to actually read the data:</p>
 
     <pre class="brush: java;">
-    @Override
-    public Class&lt;? extends Task&gt; taskClass() {
-        return FileStreamSourceTask.class;
-    }
-    </pre>
+@Override
+public Class&lt;? extends Task&gt; taskClass() {
+    return FileStreamSourceTask.class;
+}</pre>
 
     <p>We will define the <code>FileStreamSourceTask</code> class below. Next, we add some standard lifecycle methods, <code>start()</code> and <code>stop()</code>:</p>
 
     <pre class="brush: java;">
-    @Override
-    public void start(Map&lt;String, String&gt; props) {
-        // The complete version includes error handling as well.
-        filename = props.get(FILE_CONFIG);
-        topic = props.get(TOPIC_CONFIG);
-    }
-
-    @Override
-    public void stop() {
-        // Nothing to do since no background monitoring is required.
-    }
-    </pre>
+@Override
+public void start(Map&lt;String, String&gt; props) {
+    // The complete version includes error handling as well.
+    filename = props.get(FILE_CONFIG);
+    topic = props.get(TOPIC_CONFIG);
+}
+
+@Override
+public void stop() {
+    // Nothing to do since no background monitoring is required.
+}</pre>
 
     <p>Finally, the real core of the implementation is in <code>taskConfigs()</code>. In this case we are only
     handling a single file, so even though we may be permitted to generate more tasks as per the
     <code>maxTasks</code> argument, we return a list with only one entry:</p>
 
     <pre class="brush: java;">
-    @Override
-    public List&lt;Map&lt;String, String&gt;&gt; taskConfigs(int maxTasks) {
-        ArrayList&lt;Map&lt;String, String&gt;&gt; configs = new ArrayList&lt;&gt;();
-        // Only one input stream makes sense.
-        Map&lt;String, String&gt; config = new HashMap&lt;&gt;();
-        if (filename != null)
-            config.put(FILE_CONFIG, filename);
-        config.put(TOPIC_CONFIG, topic);
-        configs.add(config);
-        return configs;
-    }
-    </pre>
+@Override

Review comment:
       Does putting this in a CDATA let us avoid the eye-bleeding HTML escaping?




-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org