Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CD

on:
push:
tags: [ "v*.*.*" ]

permissions:
contents: write

env:
CGO_ENABLED: 0
APP: ${{ github.event.repository.name }}
VERSION: ${{ github.ref_name }}

jobs:
build:
name: Build and package
runs-on: ubuntu-latest
steps:
- name: Setup go
uses: actions/setup-go@v3.5.0
with:
go-version: 1.24
- name: Clone repo
uses: actions/checkout@v3
- name: Build and package (linux/amd64)
run: |
GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.commit=${{ github.sha }}' -X 'main.tag=${{ env.VERSION }}'" -o build/linux-amd64/${{ env.APP }}
tar -czvf build/${{ env.APP }}-${{ env.VERSION }}-linux-amd64.tar.gz -C build/linux-amd64 ${{ env.APP }}
- name: Build and package (darwin/amd64)
run: |
GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'main.commit=${{ github.sha }}' -X 'main.tag=${{ env.VERSION }}'" -o build/darwin-amd64/${{ env.APP }}
tar -czvf build/${{ env.APP }}-${{ env.VERSION }}-darwin-amd64.tar.gz -C build/darwin-amd64 ${{ env.APP }}
- name: Build and package (darwin/arm64)
run: |
GOOS=darwin GOARCH=arm64 go build -ldflags="-X 'main.commit=${{ github.sha }}' -X 'main.tag=${{ env.VERSION }}'" -o build/darwin-arm64/${{ env.APP }}
tar -czvf build/${{ env.APP }}-${{ env.VERSION }}-darwin-arm64.tar.gz -C build/darwin-arm64 ${{ env.APP }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
if-no-files-found: error
path: build/*.tar.gz
retention-days: 1
overwrite: true
release:
name: Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: build
- name: Create release
id: create_release
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
files: |
build/${{ env.APP }}-${{ env.VERSION }}-linux-amd64.tar.gz
build/${{ env.APP }}-${{ env.VERSION }}-darwin-amd64.tar.gz
build/${{ env.APP }}-${{ env.VERSION }}-darwin-arm64.tar.gz
- name: Report
run: |
echo "release url: ${{ steps.create_release.outputs.url }}"
16 changes: 14 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,21 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3.5.0
with:
go-version: 1.23
go-version: 1.24
- name: Clone repo
uses: actions/checkout@v3
- name: Build
run: make build
run: CGO_ENABLED=0;go build -o /dev/null
test:
runs-on: ubuntu-latest
steps:
- name: Setup go
uses: actions/setup-go@v3.5.0
with:
go-version: 1.24
- name: Clone repo
uses: actions/checkout@v3
- name: Integration Test
run: tests/integration-tests.sh


15 changes: 15 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Installing Klient

If `go` is available on the machine, `klient` can be installed quickly by running the below.

```bash
go install github.com/comradequinn/klient
```

Alternatively, you can install `klient` by downloading the appropriate tarball for your `os` from the [releases](https://github.com/comradequinn/klient/releases) page. Extract the binary and place it somewhere accessible to your `$PATH` variable.

Optionally, `linux` users can have the below script quickly do this for them.

```bash
export VERSION="v1.2.0"; export OS="linux-amd64"; wget "https://github.com/comradequinn/klient/releases/download/${VERSION}/klient-${VERSION}-${OS}.tar.gz" && tar -xf "klient-${VERSION}-${OS}.tar.gz" && rm -f "klient-${VERSION}-${OS}.tar.gz" && chmod +x klient && sudo mv klient /usr/local/bin/
```
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ build :
@CGO_ENABLED=0;go build -o bin/klient

stop-kafka:
-@docker rm -f kafka-broker 2> /dev/null
-@podman container rm -f kafka-broker

local-kafka: stop-kafka
@docker run -d -p 9092:9092 --rm --name kafka-broker apache/kafka:latest
start-kafka: stop-kafka
@podman container run -d -p 9092:9092 --rm --name kafka-broker docker.io/apache/kafka:latest

BOOTSTRAPPERS="localhost:9092"
info : build
Expand All @@ -29,4 +29,4 @@ create-topic : build
@bin/klient -c ${TOPIC} -p ${PARTITIONS} -n ${REPLICAS} -b ${BOOTSTRAPPERS}

delete-topic : build
-@bin/klient -d ${TOPIC} -b ${BOOTSTRAPPERS}
-@bin/klient -d ${TOPIC} -b ${BOOTSTRAPPERS}
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,14 @@ The `klient` utility exposes simplifed kafka cluster administration operations f

## Installation

If `go` is available on the machine, `klient` can be installed quickly by running the below.

```bash
go install github.com/comradequinn/klient
```

Alternatively, there is a `amd64/linux` binary in this repo's `/bin` directory. Copy this repo to a location in your `$PATH` variable and grant it execute permissions.
Installation instructions are available [here](./INSTALL.md)

### Local Kafka Broker

The `Makefile` contains a convenience target to spin up a local `kafka broker` which will be available at `localhost:9092`, as shown below.

```bash
make local-kafka
make start-kafka
```

The broker can be stopped by running the below
Expand Down Expand Up @@ -95,7 +89,7 @@ Alternatively, specify these attributes as required:

```bash
# specify a partition count of 3 and a replication factor of 1
klient -c "my-topic" -p 3 -r 1 -b "localhost:9092"
klient -c "my-topic" -p 3 -n 1 -b "localhost:9092"
```

## Topic Deletion
Expand Down
Binary file modified bin/klient
Binary file not shown.
2 changes: 1 addition & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
writerFunc WriterFunc
)

// generate me a unit test for this
// generate me a unit test for this
func Init(k KafkaReaderWriter, wf WriterFunc) {
kafka = k
writerFunc = wf
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/comradequinn/klient

require github.com/segmentio/kafka-go v0.4.32
require github.com/segmentio/kafka-go v0.4.48

require (
github.com/klauspost/compress v1.15.9 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
)

go 1.23
go 1.24
53 changes: 53 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,84 @@ github.com/klauspost/compress v1.14.2 h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi2
github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY=
github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/pierrec/lz4/v4 v4.1.14 h1:+fL8AQEZtz/ijeNnpduH0bROTu0O3NZAlPjQxGn8LwE=
github.com/pierrec/lz4/v4 v4.1.14/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0=
github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU=
github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/segmentio/kafka-go v0.4.32 h1:Ohr+9E+kDv/Ld2UPJN9hnKZRd2qgiqCmI8v2e1qlfLM=
github.com/segmentio/kafka-go v0.4.32/go.mod h1:JAPPIiY3MQIwVHj64CWOP0LsFFfQ7H0w69kuoxnMIS0=
github.com/segmentio/kafka-go v0.4.48 h1:9jyu9CWK4W5W+SroCe8EffbrRZVqAOkuaLd/ApID4Vs=
github.com/segmentio/kafka-go v0.4.48/go.mod h1:HjF6XbOKh0Pjlkr5GVZxt6CsjjwnmhVOfURM5KMd8qg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c h1:u40Z8hqBAAQyv+vATcGgV0YCnDjqSL7/q/JyPhhJSPk=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v1.0.0 h1:d9X0esnoa3dFsV0FG35rAT0RIhYFlPq7MiP+DW89La0=
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284 h1:rlLehGeYg6jfoyz/eDqDU1iRXLKfR42nnNh57ytKEWo=
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20220512140231-539c8e751b99 h1:dbuHpmKjkDzSOMKAWl10QNlgaZUd3V1q99xc81tt2Kc=
gopkg.in/yaml.v3 v3.0.0-20220512140231-539c8e751b99/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
14 changes: 7 additions & 7 deletions kafio/kafio.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

type (
Connection struct {
controller *kafka.Conn
driver *kafka.Conn
bootstrappers []string
}
Message struct {
Expand Down Expand Up @@ -53,7 +53,7 @@ func Connect(bootstrappers []string) (*Connection, error) {
)

for _, bs := range bootstrappers {
if connection.controller, err = kafka.Dial("tcp", bs); err != nil {
if connection.driver, err = kafka.Dial("tcp", bs); err != nil {
log.Printf("error connecting to bootstrapper [%v]: %v", bs, err)
continue
}
Expand All @@ -64,11 +64,11 @@ func Connect(bootstrappers []string) (*Connection, error) {
return nil, fmt.Errorf("unable to connect to any of the specified bootstrappers [%+v]: %v", bootstrappers, err)
}

if controllerBroker, err = connection.controller.Controller(); err != nil {
if controllerBroker, err = connection.driver.Controller(); err != nil {
return nil, fmt.Errorf("unable to ascertain the cluster controller: %v", err)
}

if connection.controller, err = kafka.Dial("tcp", net.JoinHostPort(controllerBroker.Host, strconv.Itoa(controllerBroker.Port))); err != nil {
if connection.driver, err = kafka.Dial("tcp", net.JoinHostPort(controllerBroker.Host, strconv.Itoa(controllerBroker.Port))); err != nil {
return nil, fmt.Errorf("unable to connect to the cluster controller: %v", err)
}

Expand All @@ -78,7 +78,7 @@ func Connect(bootstrappers []string) (*Connection, error) {
// Topics returns a map keyed on the cluster's topics with
// the value being the partition count
func (conn *Connection) Topics() (map[string]int, error) {
partitions, err := conn.controller.ReadPartitions()
partitions, err := conn.driver.ReadPartitions()

if err != nil {
return nil, fmt.Errorf("error reading cluster info. %v", err)
Expand Down Expand Up @@ -119,7 +119,7 @@ func (conn *Connection) NewTopic(name string, partitions, replicas int) error {
return err
}

err := conn.controller.CreateTopics(kafka.TopicConfig{
err := conn.driver.CreateTopics(kafka.TopicConfig{
Topic: name,
NumPartitions: partitions,
ReplicationFactor: replicas})
Expand All @@ -144,7 +144,7 @@ func (conn *Connection) DeleteTopic(name string) error {
return fmt.Errorf("cannot delete topic. topic does not exist")
}

if err := conn.controller.DeleteTopics(name); err != nil {
if err := conn.driver.DeleteTopics(name); err != nil {
return fmt.Errorf("unable to delete topic. %v", name)
}

Expand Down
11 changes: 11 additions & 0 deletions klient.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ import (
"github.com/comradequinn/klient/kafio"
)

var (
commit = "dev-build"
tag = "v0.0.0-dev.0"
)

func main() {
log.SetFlags(0)
log.SetOutput(os.Stdout)

var (
versionArg = flag.Bool("version", false, "print klient version")
bootstrappersArg = flag.String("b", "localhost:9092", "the comma separated list of kafka bootstrappers to use to connect")
writeTopicArg = flag.String("w", "", "the topic to write to")
writeTopicHeadersArg = flag.String("h", "", "the comma separated set of 'key=value' formatted headers to use when writing to a topic. eg \"k1=v1,k2=v2\"")
Expand All @@ -33,6 +39,11 @@ func main() {

flag.Parse()

if *versionArg {
log.Printf("klient version %v (commit %v)\n", tag, commit)
os.Exit(0)
}

bootstrappers := strings.Split(*bootstrappersArg, ",")

if len(bootstrappers) == 0 {
Expand Down
Binary file added tests/bin/klient
Binary file not shown.
Loading