Tabs
Creating tabbed content. This functionality is provided by a custom Asciidoctor extension. See github.com/asciidoctor/asciidoctor-tabs#syntax.
-
Go
-
Node.js
-
Python
Download and install Go from go.dev.
This Kafka client code example uses the franz-go library.
# Create and enter the project folder
mkdir redpanda-go; cd redpanda-go
# Initialize the project
go mod init com/redpanda/example
# Install required dependencies
go get github.com/twmb/franz-go
<test>
go get github.com/twmb/franz-go/pkg/kadm
go get github.com/twmb/tlscfg
go get github.com/twmb/franz-go/pkg/sasl/scram@v1.9.0
Download and install Node.js here.
This example uses the KafkaJS library.
# Create and enter the project folder
mkdir redpanda-node; cd redpanda-node
# Generate package.json (the default values are fine)
npm init
# Install required dependencies
npm i -D typescript npm i -D @types/node npm i kafkajs
# Generate
tsconfig.json tsc --init
Download and install Python 3 from python.org.
This example uses the kafka-python library.
# Create and enter the project folder
mkdir redpanda-python; cd redpanda-python
# Create virtual environment
python3 -m venv .env source .env/bin/activate
# Install dependencies (.env)
pip install kafka-python
[tabs]
====
Go::
+
--
Download and install Go
from https://go.dev/doc/install[go.dev].
This Kafka client code example
uses the https://github.com/twmb/franz-go[franz-go] library.
```bash
# Create and enter the project folder
mkdir redpanda-go; cd redpanda-go
# Initialize the project
go mod init com/redpanda/example
# Install required dependencies
go get github.com/twmb/franz-go
<test>
go get github.com/twmb/franz-go/pkg/kadm
go get github.com/twmb/tlscfg
go get github.com/twmb/franz-go/pkg/sasl/scram@v1.9.0
```
--
Node.js::
+
--
Download and install Node.js https://nodejs.org/en/download[here].
This example uses the https://kafka.js.org/[KafkaJS] library.
```bash
# Create and enter the project folder
mkdir redpanda-node; cd redpanda-node
# Generate package.json (the default values are fine)
npm init
# Install required dependencies
npm i -D typescript npm i -D @types/node npm i kafkajs
# Generate
tsconfig.json tsc --init
```
--
Python::
+
--
Download and install Python 3
from https://www.python.org/downloads[python.org].
This example uses
the https://kafka-python.readthedocs.io/en/master/[kafka-python]
library.
```bash
# Create and enter the project folder
mkdir redpanda-python; cd redpanda-python
# Create virtual environment
python3 -m venv .env source .env/bin/activate
# Install dependencies (.env)
pip install kafka-python
```
--
====
Was this helpful?