You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ew...@apache.org on 2016/06/12 00:20:27 UTC

kafka git commit: MINOR: Fix connect development guide.

Repository: kafka
Updated Branches:
  refs/heads/trunk 5b88af992 -> 250981fb9


MINOR: Fix connect development guide.

Fix some trivial misses.
ewencp

Author: uchan-nos <uc...@gmail.com>

Reviewers: Ewen Cheslack-Postava <ew...@confluent.io>

Closes #1496 from uchan-nos/docfix-connect


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/250981fb
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/250981fb
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/250981fb

Branch: refs/heads/trunk
Commit: 250981fb98113d5c693132798225e075f162d92d
Parents: 5b88af9
Author: uchan-nos <uc...@gmail.com>
Authored: Sat Jun 11 17:20:23 2016 -0700
Committer: Ewen Cheslack-Postava <me...@ewencp.org>
Committed: Sat Jun 11 17:20:23 2016 -0700

----------------------------------------------------------------------
 docs/connect.html | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/250981fb/docs/connect.html
----------------------------------------------------------------------
diff --git a/docs/connect.html b/docs/connect.html
index 4ba406e..e5a4ad2 100644
--- a/docs/connect.html
+++ b/docs/connect.html
@@ -181,16 +181,16 @@ public void stop() {
 }
 </pre>
 
-Finally, the real core of the implementation is in <code>getTaskConfigs()</code>. In this case we are only
+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:
 
 <pre>
 @Override
-public List&lt;Map&lt;String, String&gt;&gt; getTaskConfigs(int maxTasks) {
-    ArrayList&gt;Map&lt;String, String&gt;&gt; configs = new ArrayList&lt;&gt;();
+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 Map&lt;&gt;();
+    Map&lt;String, String&gt; config = new HashMap&lt;&gt;();
     if (filename != null)
         config.put(FILE_CONFIG, filename);
     config.put(TOPIC_CONFIG, topic);
@@ -214,11 +214,12 @@ Just as with the connector, we need to create a class inheriting from the approp
 
 
 <pre>
-public class FileStreamSourceTask extends SourceTask&lt;Object, Object&gt; {
+public class FileStreamSourceTask extends SourceTask {
     String filename;
     InputStream stream;
     String topic;
 
+    @Override
     public void start(Map&lt;String, String&gt; props) {
         filename = props.get(FileStreamSourceConnector.FILE_CONFIG);
         stream = openOrThrowError(filename);
@@ -356,8 +357,7 @@ Schema schema = SchemaBuilder.struct().name(NAME)
 
 Struct struct = new Struct(schema)
     .put("name", "Barbara Liskov")
-    .put("age", 75)
-    .build();
+    .put("age", 75);
 </pre>
 
 If you are implementing a source connector, you'll need to decide when and how to create schemas. Where possible, you should avoid recomputing them as much as possible. For example, if your connector is guaranteed to have a fixed schema, create it statically and reuse a single instance.