Documentation ¶
Index ¶
- func AppendPrefixTo(name string) string
- func Brokers() ([]string, error)
- func NewAsyncProducer(cfg *sarama.Config) (sarama.AsyncProducer, error)
- func NewConsumer(cfg *sarama.Config) (sarama.Consumer, error)
- func NewSyncProducer(cfg *sarama.Config) (sarama.SyncProducer, error)
- func NewTLSConfig(trustedCert string, clientCert string, clientKey string) (*tls.Config, error)
- func TLSConfig() (*tls.Config, error)
- type Config
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendPrefixTo ¶
AppendPrefixTo adds the env variable KAFKA_PREFIX to the given string if necessary. Heroku requires prefixing topics and consumer group names with the prefix on multi-tenant plans. It is safe to use on dedicated clusters if KAFKA_PREFIX is not set.
func Brokers ¶
Brokers returns a list of host:port addresses for the Kafka brokers set in KAFKA_URL.
func NewAsyncProducer ¶
func NewAsyncProducer(cfg *sarama.Config) (sarama.AsyncProducer, error)
NewAsyncProducer creates a github.com/Shopify/sarama.AsyncProducer configured from the standard Heroku Kafka environment. When publishing messages to Multitenant Kafka all topics need to start with KAFKA_PREFIX which is best added using AppendPrefixTo.
func NewConsumer ¶
NewConsumer creates a github.com/Shopify/sarama.Consumer configured from the standard Heroku Kafka environment.
func NewSyncProducer ¶
func NewSyncProducer(cfg *sarama.Config) (sarama.SyncProducer, error)
NewSyncProducer creates a github.com/Shopify/sarama.SyncProducer configured from the standard Heroku Kafka environment. When publishing messages to Multitenant Kafka all topics need to start with KAFKA_PREFIX which is best added using AppendPrefixTo.
func NewTLSConfig ¶
NewTLSConfig constructs a *tls.Config from the given certificates that is appropriate for connecting to a Heroku Kafka broker.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func NewConfigWithName ¶
NewConfigWithName returns a Config pulling from HEROKU_KAFKA_[NAME] environment variables. Using an empty string for name will use the unnamed Kafka instance.
func (*Config) Prefix ¶
Prefix is used to add the Heroku prefix to topics and consumer group ids. It is safe to use when no prefix is set or when the given name is already prefixed.