Skip to content
A Go client library for Apache Pulsar
Branch: master
Clone or download
davidwalter0 Consumer/position (#18)
* Add ability to consume from beginning of topic

This allows for the `InitialPosition` field to be set when creating a
new subscriber. More tests should be added around this in the future.
For now, it's only available for "exclusive" consumers, but could be
added to other subscription types.

* expose options for re-reading unacked messages (#13)

* expose options for re-reading unacked messages

Signed-off-by: David Walter <davidwalter0@users.noreply.github.com>

* fix comment typos

Signed-off-by: David Walter <davidwalter0@users.noreply.github.com>

* Per review: prefer caller returns result directly

Signed-off-by: David Walter <davidwalter0@users.noreply.github.com>

* update comment wording

* add reconnect logic with unacknowledged reads (#17)

- pulsar unacknowledged reads initial reads work
- some unacknowledged subsequent reads fail
- some use cases cases invalidate queue connections
- deferrable lock release
Latest commit d669484 Jan 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
api Pulsar 2.0 (#10) Jul 27, 2018
cli
frame
fuzz Fix fuzz readme formatting Jul 27, 2018
pulsar-conf
pulsartest
testdata/frames
vendor/github.com/golang/protobuf
.gitignore Pulsar 2.0 (#10) Jul 27, 2018
CHANGELOG.md
CONTRIBUTING.md
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
NOTICE
README.md Pulsar 2.0 (#10) Jul 27, 2018
async_errors.go Add fuzz test (#7) Jul 19, 2018
async_errors_test.go
client.go
client_integration_test.go
client_test.go
conn.go
conn_integration_test.go
conn_test.go
connector.go
connector_test.go
consumer.go
consumer_test.go
discoverer.go Add fuzz test (#7) Jul 19, 2018
discoverer_test.go
doc.go Add fuzz test (#7) Jul 19, 2018
errunexpected.go Add fuzz test (#7) Jul 19, 2018
framedispatcher.go
framedispatcher_test.go
integration_test.go
managed_client.go
managed_client_pool.go
managed_client_pool_test.go Add fuzz test (#7) Jul 19, 2018
managed_client_test.go Add fuzz test (#7) Jul 19, 2018
managed_consumer.go Consumer/position (#18) Jan 25, 2019
managed_consumer_integration_test.go
managed_consumer_test.go Extract Frame into own package (#11) Jul 27, 2018
managed_producer.go
managed_producer_test.go Extract Frame into own package (#11) Jul 27, 2018
message.go Add fuzz test (#7) Jul 19, 2018
mocksender_test.go
mockserver_test.go
monotonic.go
monotonic_test.go
pinger.go
pinger_test.go
producer.go
producer_test.go
pubsub.go
pubsub_test.go Consumer/position re-consume unacked or from topic start (#16) Jan 25, 2019
subscriptions.go
util_test.go Extract Frame into own package (#11) Jul 27, 2018

README.md

pulsar-client-go

A Go client library for the Apache Pulsar project.

GoDoc

Alternatives

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 golang/protbuf library.

Status & Goals

Status

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

Goals

  • 100% Go
  • Simplicity

Installation

go get -u github.com/Comcast/pulsar-client-go

Note: The package name is pulsar

Example

An example of a producer and consumer can be seen in the included cli application.

Contributions

Contributions are welcome. Please create an issue before beginning work on major contributions. Refer to the CONTRIBUTING.md doc for more information.

Local Development

Integration Tests

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"

Protobuf

The Makefile target api/PulsarApi.pb.go will generate the required .go files using the Pulsar source's .proto files.

Usage:

$ make api/PulsarApi.pb.go

Local Pulsar

Notes on installing Pulsar locally.

Prereqs:

  • For Java8 on OSX, use these instructions stackoverflow

  • Checkout source from github

    git clone git@github.com:apache/incubator-pulsar.git
  • Switch to desired tag, eg v1.22.1-incubating

  • Install Maven

    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

The Makefile has various targets to support certificate generation, Pulsar TLS configuration, and topic setup:

  • Generate certificates for use by brokers, admin tool, and applications:

     make certificates

    This will create broker, admin, and app private/public pairs in the certs directory.

  • Generate configuration files for running Pulsar standalone and pulsar-admin with TLS enabled using generated certificates:

     make pulsar-tls-conf

    This will generate pulsar-conf/standalone.tls.conf and pulsar-conf/client.tls.conf files that can be used as the configurations for the standalone server and pulsar-admin tools respectively. They'll use the certificates in the certs directory. The files should be placed in the appropriate locations for use with those tools (probably the conf directory 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:

     make standalone-tls-ns

    This will create a sample/standalone/ns1 topic. The app certificate will have produce, consume rights on the topic.

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

You can’t perform that action at this time.