You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jl...@apache.org on 2024/02/05 15:44:00 UTC
(kafka) branch trunk updated: MINOR: Fix code listings in quickstart.html (#10767)
This is an automated email from the ASF dual-hosted git repository.
jlprat pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new f54975c3313 MINOR: Fix code listings in quickstart.html (#10767)
f54975c3313 is described below
commit f54975c33135140351c50370282e86c49c81bbdd
Author: Josep Prat <jo...@aiven.io>
AuthorDate: Mon Feb 5 16:43:53 2024 +0100
MINOR: Fix code listings in quickstart.html (#10767)
* MINOR: Fix code listings in quickstart
Uses the right syntax highlighting
Reviewers: Mickael Maison <mi...@gmail.com>, Luke Chen <sh...@gmail.com>
---
docs/quickstart.html | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/docs/quickstart.html b/docs/quickstart.html
index e0c84279347..455fd8b267c 100644
--- a/docs/quickstart.html
+++ b/docs/quickstart.html
@@ -152,7 +152,7 @@ $ bin/kafka-server-start.sh config/server.properties</code></pre>
<pre class="line-numbers"><code class="language-bash">$ bin/kafka-topics.sh --describe --topic quickstart-events --bootstrap-server localhost:9092
Topic: quickstart-events TopicId: NPmZHyhbR9y00wMglMH2sg PartitionCount: 1 ReplicationFactor: 1 Configs:
- Topic: quickstart-events Partition: 0 Leader: 0 Replicas: 0 Isr: 0</code></pre>
+Topic: quickstart-events Partition: 0 Leader: 0 Replicas: 0 Isr: 0</code></pre>
</div>
<div class="quickstart-step">
@@ -173,8 +173,8 @@ Topic: quickstart-events TopicId: NPmZHyhbR9y00wMglMH2sg PartitionCount:
</p>
<pre class="line-numbers"><code class="language-bash">$ bin/kafka-console-producer.sh --topic quickstart-events --bootstrap-server localhost:9092
-This is my first event
-This is my second event</code></pre>
+>This is my first event
+>This is my second event</code></pre>
<p>
You can stop the producer client with <code>Ctrl-C</code> at any time.
@@ -233,19 +233,16 @@ This is my second event</code></pre>
Edit the <code class="language-bash">config/connect-standalone.properties</code> file, add or change the <code>plugin.path</code> configuration property match the following, and save the file:
</p>
- <pre class="brush: bash;">
-> echo "plugin.path=libs/connect-file-{{fullDotVersion}}.jar"</pre>
+ <pre class="line-numbers"><code class="language-bash">$ echo "plugin.path=libs/connect-file-{{fullDotVersion}}.jar >> config/connect-standalone.properties"</code></pre>
<p>
Then, start by creating some seed data to test with:
</p>
- <pre class="brush: bash;">
-> echo -e "foo\nbar" > test.txt</pre>
+ <pre class="line-numbers"><code class="language-bash">$ echo -e "foo\nbar" > test.txt</code></pre>
Or on Windows:
- <pre class="brush: bash;">
-> echo foo> test.txt
-> echo bar>> test.txt</pre>
+ <pre class="line-numbers"><code class="language-bash">$ echo foo> test.txt
+$ echo bar>> test.txt</code></pre>
<p>
Next, we'll start two connectors running in <i>standalone</i> mode, which means they run in a single, local, dedicated
@@ -255,8 +252,7 @@ This is my second event</code></pre>
class to instantiate, and any other configuration required by the connector.
</p>
- <pre class="brush: bash;">
-> bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties config/connect-file-sink.properties</pre>
+ <pre class="line-numbers"><code class="language-bash">$ bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties config/connect-file-sink.properties</code></pre>
<p>
These sample configuration files, included with Kafka, use the default local cluster configuration you started earlier
@@ -273,10 +269,9 @@ This is my second event</code></pre>
</p>
- <pre class="brush: bash;">
-> more test.sink.txt
+ <pre class="line-numbers"><code class="language-bash">$ more test.sink.txt
foo
-bar</pre>
+bar</code></pre>
<p>
Note that the data is being stored in the Kafka topic <code>connect-test</code>, so we can also run a console consumer to see the
@@ -284,16 +279,14 @@ bar</pre>
</p>
- <pre class="brush: bash;">
-> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic connect-test --from-beginning
+ <pre class="line-numbers"><code class="language-bash">$ bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic connect-test --from-beginning
{"schema":{"type":"string","optional":false},"payload":"foo"}
{"schema":{"type":"string","optional":false},"payload":"bar"}
-...</pre>
+…</code></pre>
<p>The connectors continue to process data, so we can add data to the file and see it move through the pipeline:</p>
- <pre class="brush: bash;">
-> echo Another line>> test.txt</pre>
+ <pre class="line-numbers"><code class="language-bash">$ echo Another line>> test.txt</code></pre>
<p>You should see the line appear in the console consumer output and in the sink file.</p>
@@ -318,7 +311,7 @@ bar</pre>
<p>To give you a first taste, here's how one would implement the popular <code>WordCount</code> algorithm:</p>
- <pre class="line-numbers"><code class="language-bash">KStream<String, String> textLines = builder.stream("quickstart-events");
+ <pre class="line-numbers"><code class="language-java">KStream<String, String> textLines = builder.stream("quickstart-events");
KTable<String, Long> wordCounts = textLines
.flatMapValues(line -> Arrays.asList(line.toLowerCase().split(" ")))