kafka

package
v0.0.0-...-4581c0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observer

type Observer struct {
	// contains filtered or unexported fields
}

Observer handles events from kafka

func (*Observer) Close

func (o *Observer) Close() error

Close cancel observation and close connection to kafka.

func (*Observer) SetTopics

func (o *Observer) SetTopics(ctx context.Context, topics []string) error

type Publisher

type Publisher struct {
	// contains filtered or unexported fields
}

Publisher implements a eventbus.Publisher interface.

func NewPublisher

func NewPublisher(brokers []string, config *sarama.Config, eventMarshaler event.MarshalerFunc) (*Publisher, error)

NewPublisher creates a publisher.

func (*Publisher) Close

func (b *Publisher) Close() error

Close close publisher.

func (*Publisher) Publish

func (b *Publisher) Publish(ctx context.Context, topics []string, groupId, aggregateId string, event event.Event) error

Publish publishes an event to topics.

type Subscriber

type Subscriber struct {
	// contains filtered or unexported fields
}

Subscriber implements a eventbus.Subscriber interface.

func NewSubscriber

func NewSubscriber(brokers []string, config *sarama.Config, eventUnmarshaler event.UnmarshalerFunc, goroutinePoolGo eventbus.GoroutinePoolGoFunc, errFunc eventbus.ErrFunc) (*Subscriber, error)

NewSubscriber creates a subscriber.

func (*Subscriber) Subscribe

func (b *Subscriber) Subscribe(ctx context.Context, subscriptionID string, topics []string, eh event.Handler) (eventbus.Observer, error)

Subscribe creates a observer that listen on events from topics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL