A Go client library for the Apache Pulsar project.
The Pulsar project contains a Go client library that is a wrapper for the Pulsar C++ client library.
In comparison, this library is 100% Go (no cgo required). Outside the Go standard library, it has a single dependency on the
Status & Goals
This client is a work-in-progress and as such does not support all Pulsar features. It supports Pulsar 2.0 along with 1.22.
The following is an incomplete list of features that are not yet implemented:
- Batch frame support
- Payload compression support
- Partitioned topics support
- Athenz authentication support
- Encryption support
- 100% Go
go get -u github.com/Comcast/pulsar-client-go
Note: The package name is
An example of a producer and consumer can be seen in the included cli application.
Contributions are welcome. Please create an issue before beginning work on major contributions. Refer to the CONTRIBUTING.md doc for more information.
Integration tests are provided that connect to a Pulsar sever. They are best run against a local instance of Pulsar, since they expect the standalone properties to exist. See below for instructions on installing Pulsar locally.
Integration tests will be run when provided the
pulsar flag with the address of the Pulsar server to connect to. Example:
go test -v -pulsar "localhost:6650"
api/PulsarApi.pb.go will generate the required .go files
using the Pulsar source's .proto files.
$ make api/PulsarApi.pb.go
Notes on installing Pulsar locally.
For Java8 on OSX, use these instructions stackoverflow
Checkout source from github
git clone email@example.com:apache/incubator-pulsar.git
Switch to desired tag, eg
brew install maven
Compile (full instructions)
mvn install -DskipTests
Launch Pulsar from Pulsar directory:
./bin/pulsar standalone --wipe-data --advertised-address localhost
Local Pulsar + TLS
Makefile has various targets to support certificate generation, Pulsar TLS configuration, and topic setup:
Generate certificates for use by brokers, admin tool, and applications:
This will create
appprivate/public pairs in the certs directory.
Generate configuration files for running Pulsar standalone and
pulsar-adminwith TLS enabled using generated certificates:
This will generate
pulsar-conf/client.tls.conffiles that can be used as the configurations for the standalone server and
pulsar-admintools respectively. They'll use the certificates in the
certsdirectory. The files should be placed in the appropriate locations for use with those tools (probably the
confdirectory within the Pulsar directory). It's recommended to use symbolic-links to easily switch between configurations.
Setup sample topic on standalone server with TLS enabled:
This will create a
appcertificate will have
consumerights on the topic.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0