tree: 617fc70565e91b7a812876a008711634ae6b2f55 [path history] [tgz]
  1. .gitignore
  2. 00version.go
  3. README.md
  4. adminapi.go
  5. adminoptions.go
  6. api.html
  7. build_dynamic.go
  8. build_static.go
  9. build_static_all.go
  10. config.go
  11. consumer.go
  12. error.go
  13. event.go
  14. generated_errors.go
  15. glue_rdkafka.h
  16. handle.go
  17. header.go
  18. kafka.go
  19. message.go
  20. metadata.go
  21. misc.go
  22. offset.go
  23. producer.go
  24. testconf-example.json
  25. testhelpers.go
vendor/github.com/confluentinc/confluent-kafka-go/kafka/README.md

Information for confluent-kafka-go developers

Whenever librdkafka error codes are updated make sure to run generate before building:

  $ (cd go_rdkafka_generr && go install) && go generate
  $ go build

Testing

Some of the tests included in this directory, the benchmark and integration tests in particular, require an existing Kafka cluster and a testconf.json configuration file to provide tests with bootstrap brokers, topic name, etc.

The format of testconf.json is a JSON object:

{
  "Brokers": "<bootstrap-brokers>",
  "Topic": "<test-topic-name>"
}

See testconf-example.json for an example and full set of available options.

To run unit-tests:

$ go test

To run benchmark tests:

$ go test -bench .

For the code coverage:

$ go test -coverprofile=coverage.out -bench=.
$ go tool cover -func=coverage.out

Build tags (static linking)

Different build types are supported through Go build tags (-tags ..), these tags should be specified on the application build command.

  • static - Build with librdkafka linked statically (but librdkafka dependencies linked dynamically).
  • static_all - Build with all libraries linked statically.
  • neither - Build with librdkafka (and its dependencies) linked dynamically.

Generating HTML documentation

To generate one-page HTML documentation run the mk/doc-gen.py script from the top-level directory. This script requires the beautifulsoup4 Python package.

$ source .../your/virtualenv/bin/activate
$ pip install beautifulsoup4
...
$ mk/doc-gen.py > kafka.html