Documentation ¶
Overview ¶
Package nsqx is a generated GoMock package.
Index ¶
- Constants
- type Consumer
- type ConsumerConfiguration
- type ConsumerController
- type ConsumerHandler
- type ConsumerInterceptor
- type ConsumerItf
- type ConsumerParam
- type FuncConsumer
- type MockConsumerItf
- type MockConsumerItfMockRecorder
- type MockProducerItf
- type MockProducerItfMockRecorder
- type Producer
- type ProducerConfiguration
- type ProducerItf
Constants ¶
const TimeoutDuration = time.Second * 60
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer struct { Topic string Channel string Method string // contains filtered or unexported fields }
func NewConsumer ¶
func NewConsumer( ctrl *ConsumerController, topic, channel string, config *ConsumerConfiguration, consumer ConsumerItf, ) *Consumer
func (*Consumer) HandleMessage ¶
type ConsumerConfiguration ¶
type ConsumerConfiguration struct { NSQ *nsq.Config LookupAddress []string Concurrency int MaxInFlight int MaxAttempts uint16 }
func (*ConsumerConfiguration) Validate ¶
func (c *ConsumerConfiguration) Validate() error
type ConsumerController ¶
type ConsumerController struct {
// contains filtered or unexported fields
}
func NewConsumerController ¶
func NewConsumerController(interceptors ...ConsumerInterceptor) *ConsumerController
func (*ConsumerController) AddConsumers ¶
func (c *ConsumerController) AddConsumers(params []ConsumerParam) error
func (*ConsumerController) Serve ¶
func (c *ConsumerController) Serve()
type ConsumerHandler ¶
ConsumerHandler is the handler definition to run a consumer.
type ConsumerInterceptor ¶
type ConsumerInterceptor func(ctx context.Context, consumer *Consumer, handler ConsumerHandler) error
ConsumerInterceptor is the middleware that will be executed before the current handler.
func ConsumerChain ¶
func ConsumerChain(interceptors ...ConsumerInterceptor) ConsumerInterceptor
ConsumerChain returns a single interceptor from multiple interceptors.
type ConsumerItf ¶
ConsumerItf is consumer interface to consume nsq message.
type ConsumerParam ¶
type ConsumerParam struct { Topic string Channel string Config *ConsumerConfiguration Consumer ConsumerItf }
type FuncConsumer ¶
FuncConsumer is a type to allow callers to wrap a raw func.
type MockConsumerItf ¶
type MockConsumerItf struct {
// contains filtered or unexported fields
}
MockConsumerItf is a mock of ConsumerItf interface.
func NewMockConsumerItf ¶
func NewMockConsumerItf(ctrl *gomock.Controller) *MockConsumerItf
NewMockConsumerItf creates a new mock instance.
func (*MockConsumerItf) EXPECT ¶
func (m *MockConsumerItf) EXPECT() *MockConsumerItfMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockConsumerItfMockRecorder ¶
type MockConsumerItfMockRecorder struct {
// contains filtered or unexported fields
}
MockConsumerItfMockRecorder is the mock recorder for MockConsumerItf.
func (*MockConsumerItfMockRecorder) Handle ¶
func (mr *MockConsumerItfMockRecorder) Handle(ctx, message interface{}) *gomock.Call
Handle indicates an expected call of Handle.
type MockProducerItf ¶
type MockProducerItf struct {
// contains filtered or unexported fields
}
MockProducerItf is a mock of ProducerItf interface.
func NewMockProducerItf ¶
func NewMockProducerItf(ctrl *gomock.Controller) *MockProducerItf
NewMockProducerItf creates a new mock instance.
func (*MockProducerItf) DeferredPublish ¶
func (m *MockProducerItf) DeferredPublish(ctx context.Context, topic string, delay time.Duration, data interface{}) error
DeferredPublish mocks base method.
func (*MockProducerItf) EXPECT ¶
func (m *MockProducerItf) EXPECT() *MockProducerItfMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockProducerItfMockRecorder ¶
type MockProducerItfMockRecorder struct {
// contains filtered or unexported fields
}
MockProducerItfMockRecorder is the mock recorder for MockProducerItf.
func (*MockProducerItfMockRecorder) DeferredPublish ¶
func (mr *MockProducerItfMockRecorder) DeferredPublish(ctx, topic, delay, data interface{}) *gomock.Call
DeferredPublish indicates an expected call of DeferredPublish.
func (*MockProducerItfMockRecorder) Publish ¶
func (mr *MockProducerItfMockRecorder) Publish(ctx, topic, data interface{}) *gomock.Call
Publish indicates an expected call of Publish.
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
func NewProducer ¶
func NewProducer(config *ProducerConfiguration) (*Producer, error)
NewProducer creates a client to publish message to nsq.
type ProducerConfiguration ¶
func (*ProducerConfiguration) Validate ¶
func (p *ProducerConfiguration) Validate() error
type ProducerItf ¶
type ProducerItf interface { // Publish sends data to nsq. // Data should be json bytes but the struct or map. Publish(ctx context.Context, topic string, data interface{}) error // DeferredPublish sends data to nsq after certain delay. DeferredPublish(ctx context.Context, topic string, delay time.Duration, data interface{}) error }
ProducerItf is producer interface to publish nsq message.