consumer

package
v0.0.0-...-bb2c675 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package consumer is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(consumeFn ConsumeFn, opts Options) server.Handler

NewHandler creates a new handler.

func NewServer

func NewServer(addr string, opts ServerOptions) server.Server

NewServer creates a new server.

Types

type Configuration

type Configuration struct {
	Encoder                   *proto.Configuration          `yaml:"encoder"`
	Decoder                   *proto.Configuration          `yaml:"decoder"`
	MessagePool               *pool.ObjectPoolConfiguration `yaml:"messagePool"`
	AckFlushInterval          *time.Duration                `yaml:"ackFlushInterval"`
	AckBufferSize             *int                          `yaml:"ackBufferSize"`
	ConnectionWriteBufferSize *int                          `yaml:"connectionWriteBufferSize"`
	ConnectionReadBufferSize  *int                          `yaml:"connectionReadBufferSize"`
}

Configuration configs the consumer options.

func (*Configuration) NewOptions

func (c *Configuration) NewOptions(iOpts instrument.Options) Options

NewOptions creates consumer options.

type ConsumeFn

type ConsumeFn func(c Consumer)

ConsumeFn processes the consumer.

type Consumer

type Consumer interface {
	// Message waits for and returns the next message received.
	Message() (Message, error)

	// Init initializes the consumer.
	Init()

	// Close closes the consumer.
	Close()
}

Consumer receives messages from a connection.

type Listener

type Listener interface {
	// Accept waits for and returns the next connection based consumer.
	Accept() (Consumer, error)

	// Close closes the listener.
	// Any blocked Accept operations will be unblocked and return errors.
	Close() error

	// Addr returns the listener's network address.
	Addr() net.Addr
}

Listener is a consumer listener based on a network address.

func NewListener

func NewListener(addr string, opts Options) (Listener, error)

NewListener creates a consumer listener.

type Message

type Message interface {
	// Bytes returns the bytes.
	Bytes() []byte

	// Ack acks the message.
	Ack()
}

Message carries the data that needs to be processed.

type MockMessage

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

MockMessage is a mock of Message interface

func NewMockMessage

func NewMockMessage(ctrl *gomock.Controller) *MockMessage

NewMockMessage creates a new mock instance

func (*MockMessage) Ack

func (m *MockMessage) Ack()

Ack mocks base method

func (*MockMessage) Bytes

func (m *MockMessage) Bytes() []byte

Bytes mocks base method

func (*MockMessage) EXPECT

func (m *MockMessage) EXPECT() *MockMessageMockRecorder

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

type MockMessageMockRecorder

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

MockMessageMockRecorder is the mock recorder for MockMessage

func (*MockMessageMockRecorder) Ack

func (mr *MockMessageMockRecorder) Ack() *gomock.Call

Ack indicates an expected call of Ack

func (*MockMessageMockRecorder) Bytes

func (mr *MockMessageMockRecorder) Bytes() *gomock.Call

Bytes indicates an expected call of Bytes

type Options

type Options interface {
	// EncoderOptions returns the options for Encoder.
	EncoderOptions() proto.Options

	// SetEncoderOptions sets the options for Encoder.
	SetEncoderOptions(value proto.Options) Options

	// DecoderOptions returns the options for Decoder.
	DecoderOptions() proto.Options

	// SetDecoderOptions sets the options for Decoder.
	SetDecoderOptions(value proto.Options) Options

	// MessagePoolOptions returns the options for message pool.
	MessagePoolOptions() pool.ObjectPoolOptions

	// SetMessagePoolOptions sets the options for message pool.
	SetMessagePoolOptions(value pool.ObjectPoolOptions) Options

	// AckFlushInterval returns the ack flush interval.
	AckFlushInterval() time.Duration

	// SetAckFlushInterval sets the ack flush interval.
	SetAckFlushInterval(value time.Duration) Options

	// AckBufferSize returns the ack buffer size.
	AckBufferSize() int

	// SetAckBufferSize sets the ack buffer size.
	SetAckBufferSize(value int) Options

	// ConnectionWriteBufferSize returns the size of buffer before a write or a read.
	ConnectionWriteBufferSize() int

	// SetConnectionWriteBufferSize sets the buffer size.
	SetConnectionWriteBufferSize(value int) Options

	// ConnectionReadBufferSize returns the size of buffer before a write or a read.
	ConnectionReadBufferSize() int

	// SetConnectionWriteBufferSize sets the buffer size.
	SetConnectionReadBufferSize(value int) Options

	// InstrumentOptions returns the instrument options.
	InstrumentOptions() instrument.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) Options
}

Options configs the consumer listener.

func NewOptions

func NewOptions() Options

NewOptions creates a new options.

type ServerOptions

type ServerOptions interface {
	// ConsumeFn returns the ConsumeFn.
	ConsumeFn() ConsumeFn

	// SetConsumeFn sets the ConsumeFn.
	SetConsumeFn(value ConsumeFn) ServerOptions

	// RetryOptions returns the options for connection retrier.
	ServerOptions() server.Options

	// SetRetryOptions sets the options for connection retrier.
	SetServerOptions(value server.Options) ServerOptions

	// InstrumentOptions returns the instrument options.
	ConsumerOptions() Options

	// SetInstrumentOptions sets the instrument options.
	SetConsumerOptions(value Options) ServerOptions
}

ServerOptions configs the consumer server.

func NewServerOptions

func NewServerOptions() ServerOptions

NewServerOptions creates ServerOptions.

Jump to

Keyboard shortcuts

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