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 17:32:15 UTC

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

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



##########
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:
       I'm not familiar with CDATA but from a quick search it seems it shouldn't be used in HTML documents.
   https://developer.mozilla.org/en-US/docs/Web/API/CDATASection states:
   ```
   Note: CDATA sections should not be used within HTML they are considered as comments and not displayed.
   ```




-- 
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