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<? extends Task> taskClass() {
- return FileStreamSourceTask.class;
- }
- </pre>
+@Override
+public Class<? extends Task> 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<String, String> 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<String, String> 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<Map<String, String>> taskConfigs(int maxTasks) {
- ArrayList<Map<String, String>> configs = new
ArrayList<>();
- // Only one input stream makes sense.
- Map<String, String> config = new HashMap<>();
- 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]