Documentation
¶
Overview ¶
Package consumer is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
NewHandler creates a new handler.
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 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.
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) 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.
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.