kafka

package
v0.0.0-...-3b037d6 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package kafka is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultClientConfig

func DefaultClientConfig() *sarama.Config

func DefaultListenerConfig

func DefaultListenerConfig() *sarama.Config

func DefaultTopicBuilder

func DefaultTopicBuilder(topic string) string

func NewDefaultProducer

func NewDefaultProducer(channel string, client *DefaultClient, enc EncodeMessageFunc) es.Producer

Types

type Client

type Client interface {
	Send(ctx context.Context, topic string, routeKey string, message []byte) (err error)
	Close() error
}

type ConsumerOption

type ConsumerOption func(*DefaultConsumer)

func ConsumerBefore

func ConsumerBefore(before ...ConsumerRequestFunc) ConsumerOption

func ConsumerGroup

func ConsumerGroup(group string) ConsumerOption

func ConsumerTopicBuilder

func ConsumerTopicBuilder(tb TopicBuilder) ConsumerOption

type ConsumerRequestFunc

type ConsumerRequestFunc func(context.Context) context.Context

type DecodeMessageFunc

type DecodeMessageFunc func(ctx context.Context, msg []byte) (request interface{}, err error)

type DefaultClient

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

func NewClient

func NewClient(addr []string, conf *sarama.Config) (*DefaultClient, error)

func (*DefaultClient) Close

func (c *DefaultClient) Close() (err error)

func (*DefaultClient) Send

func (c *DefaultClient) Send(_ context.Context, topic string, routeKey string, message []byte) (err error)

func (*DefaultClient) SendMany

func (c *DefaultClient) SendMany(_ context.Context, messages []M) (err error)

type DefaultConsumer

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

func NewDefaultConsumer

func NewDefaultConsumer(
	channel string,
	handler es.ConsumerHandler,
	dec DecodeMessageFunc,
	newListener func() Listener,
	options ...ConsumerOption,
) *DefaultConsumer

func (*DefaultConsumer) Close

func (c *DefaultConsumer) Close() error

func (*DefaultConsumer) Consume

func (c *DefaultConsumer) Consume(ctx context.Context) error

type DefaultProducer

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

func (*DefaultProducer) Close

func (p *DefaultProducer) Close() error

func (*DefaultProducer) Send

func (p *DefaultProducer) Send(ctx context.Context, message interface{}) error

func (*DefaultProducer) SendMany

func (p *DefaultProducer) SendMany(ctx context.Context, routeKey string, message []interface{}) error

func (*DefaultProducer) SendWithRouteKey

func (p *DefaultProducer) SendWithRouteKey(ctx context.Context, routeKey string, message interface{}) error

type EncodeMessageFunc

type EncodeMessageFunc func(ctx context.Context, request interface{}) (msg []byte, err error)

type ErrorFunc

type ErrorFunc func(ctx context.Context, err error)

type Hook

type Hook func()

type Listener

type Listener interface {
	Listen(ctx context.Context, topic string, group string, fn MessageFunc) error
	Close() error
}

func NewListener

func NewListener(addr []string, conf *sarama.Config, options ...ListenerOption) Listener

type ListenerOption

type ListenerOption func(l *listener)

func ListenerErrorHandler

func ListenerErrorHandler(handler func(context.Context, error)) ListenerOption

func ListenerHooks

func ListenerHooks(setup Hook, cleanup Hook) ListenerOption

type M

type M struct {
	Topic    string
	RouteKey string
	Payload  []byte
}

type MessageFunc

type MessageFunc func(ctx context.Context, bytes []byte) error

type MockClient

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

MockClient is a mock of Client interface

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance

func (*MockClient) Close

func (m *MockClient) Close() error

Close mocks base method

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockClient) Send

func (m *MockClient) Send(ctx context.Context, topic, routeKey string, message []byte) error

Send mocks base method

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient

func (*MockClientMockRecorder) Close

func (mr *MockClientMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockClientMockRecorder) Send

func (mr *MockClientMockRecorder) Send(ctx, topic, routeKey, message interface{}) *gomock.Call

Send indicates an expected call of Send

type TopicBuilder

type TopicBuilder func(string) string

Jump to

Keyboard shortcuts

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