 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package client is a generated GoMock package.
Index ¶
- Constants
- Variables
- func StartDequeuer(ctx context.Context, cli Client, opts ...DequeueOptions) (<-chan *Message, error)
- type Client
- type DequeueOptions
- type EnqueueOptions
- type Message
- type Metadata
- type MockClient
- func (m *MockClient) Dequeue(arg0 context.Context, arg1 QueueClientConfig) (*Message, error)
- func (m *MockClient) EXPECT() *MockClientMockRecorder
- func (m *MockClient) Enqueue(arg0 context.Context, arg1 *Message, arg2 ...EnqueueOptions) error
- func (m *MockClient) ExtendMessage(arg0 context.Context, arg1 *Message) error
- func (m *MockClient) FinishMessage(arg0 context.Context, arg1 *Message) error
 
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) Dequeue(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) Enqueue(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) ExtendMessage(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) FinishMessage(arg0, arg1 interface{}) *gomock.Call
 
- type QueueClientConfig
Constants ¶
const (
	// JSONContentType represents the json content type of queue message.
	JSONContentType = "application/json"
)
    Variables ¶
var ( // ErrDequeuedMessage represents the error when message has already been dequeued. ErrDequeuedMessage = errors.New("message was dequeued by the other client") // ErrMessageNotFound represents the error when queue is empty or all messages are leased by clients. ErrMessageNotFound = errors.New("queue is empty or messages are leased") // ErrInvalidMessage represents the error when the message has already been requeued. ErrInvalidMessage = errors.New("this message has been requeued or deleted") // ErrUnsupportedContentType represents the error when the content type is unsupported. ErrUnsupportedContentType = errors.New("this message content type is unsupported") // ErrEmptyMessage represents nil or empty Message. ErrEmptyMessage = errors.New("message must not be nil or message is empty") )
Functions ¶
func StartDequeuer ¶
func StartDequeuer(ctx context.Context, cli Client, opts ...DequeueOptions) (<-chan *Message, error)
StartDequeuer starts a dequeuer to consume the message from the queue and return the output channel.
Types ¶
type Client ¶
type Client interface {
	// Enqueue enqueues message to queue.
	Enqueue(ctx context.Context, msg *Message, opts ...EnqueueOptions) error
	// Dequeue dequeues message from queue.
	Dequeue(ctx context.Context, cfg QueueClientConfig) (*Message, error)
	// FinishMessage finishes or deletes the message in the queue.
	FinishMessage(ctx context.Context, msg *Message) error
	// ExtendMessage extends the message lock.
	ExtendMessage(ctx context.Context, msg *Message) error
}
    Client is an interface to implement queue operations.
type DequeueOptions ¶
type DequeueOptions interface {
	// ApplyDequeueOption applies DequeueOptions to QueueClientConfig.
	ApplyDequeueOption(QueueClientConfig) QueueClientConfig
	// contains filtered or unexported methods
}
    func WithDequeueInterval ¶
func WithDequeueInterval(t time.Duration) DequeueOptions
WithDequeueInterval sets dequeueing interval.
type EnqueueOptions ¶
type EnqueueOptions interface {
	// contains filtered or unexported methods
}
    EnqueueOptions applies an option to Enqueue().
type Metadata ¶
type Metadata struct {
	// ID represents the unique id of message.
	ID string
	// DequeueCount represents the number of dequeue.
	DequeueCount int
	// EnqueueAt represents the time when enqueuing the message
	EnqueueAt time.Time
	// ExpireAt represents the expiry of the message.
	ExpireAt time.Time
	// NextVisibleAt represents the next visible time after dequeuing the message.
	NextVisibleAt time.Time
}
    Metadata represents the metadata of queue message.
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) Dequeue ¶
func (m *MockClient) Dequeue(arg0 context.Context, arg1 QueueClientConfig) (*Message, error)
Dequeue 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) Enqueue ¶
func (m *MockClient) Enqueue(arg0 context.Context, arg1 *Message, arg2 ...EnqueueOptions) error
Enqueue mocks base method.
func (*MockClient) ExtendMessage ¶
func (m *MockClient) ExtendMessage(arg0 context.Context, arg1 *Message) error
ExtendMessage mocks base method.
func (*MockClient) FinishMessage ¶
func (m *MockClient) FinishMessage(arg0 context.Context, arg1 *Message) error
FinishMessage mocks base method.
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
	// contains filtered or unexported fields
}
    MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) Dequeue ¶
func (mr *MockClientMockRecorder) Dequeue(arg0, arg1 interface{}) *gomock.Call
Dequeue indicates an expected call of Dequeue.
func (*MockClientMockRecorder) Enqueue ¶
func (mr *MockClientMockRecorder) Enqueue(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
Enqueue indicates an expected call of Enqueue.
func (*MockClientMockRecorder) ExtendMessage ¶
func (mr *MockClientMockRecorder) ExtendMessage(arg0, arg1 interface{}) *gomock.Call
ExtendMessage indicates an expected call of ExtendMessage.
func (*MockClientMockRecorder) FinishMessage ¶
func (mr *MockClientMockRecorder) FinishMessage(arg0, arg1 interface{}) *gomock.Call
FinishMessage indicates an expected call of FinishMessage.
type QueueClientConfig ¶
type QueueClientConfig struct {
	// DequeueIntervalDuration is the time duration between 2 successive dequeue attempts on the queue
	DequeueIntervalDuration time.Duration
}
    QueueClientConfig is a configuration for queue client APIs.
func NewDequeueConfig ¶
func NewDequeueConfig(opts ...DequeueOptions) QueueClientConfig
NewDequeueConfig returns new queue config for StartDequeuer().