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 MockClientDequeueCall
- func (c *MockClientDequeueCall) Do(f func(context.Context, QueueClientConfig) (*Message, error)) *MockClientDequeueCall
- func (c *MockClientDequeueCall) DoAndReturn(f func(context.Context, QueueClientConfig) (*Message, error)) *MockClientDequeueCall
- func (c *MockClientDequeueCall) Return(arg0 *Message, arg1 error) *MockClientDequeueCall
- type MockClientEnqueueCall
- func (c *MockClientEnqueueCall) Do(f func(context.Context, *Message, ...EnqueueOptions) error) *MockClientEnqueueCall
- func (c *MockClientEnqueueCall) DoAndReturn(f func(context.Context, *Message, ...EnqueueOptions) error) *MockClientEnqueueCall
- func (c *MockClientEnqueueCall) Return(arg0 error) *MockClientEnqueueCall
- type MockClientExtendMessageCall
- func (c *MockClientExtendMessageCall) Do(f func(context.Context, *Message) error) *MockClientExtendMessageCall
- func (c *MockClientExtendMessageCall) DoAndReturn(f func(context.Context, *Message) error) *MockClientExtendMessageCall
- func (c *MockClientExtendMessageCall) Return(arg0 error) *MockClientExtendMessageCall
- type MockClientFinishMessageCall
- func (c *MockClientFinishMessageCall) Do(f func(context.Context, *Message) error) *MockClientFinishMessageCall
- func (c *MockClientFinishMessageCall) DoAndReturn(f func(context.Context, *Message) error) *MockClientFinishMessageCall
- func (c *MockClientFinishMessageCall) Return(arg0 error) *MockClientFinishMessageCall
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) Dequeue(arg0, arg1 any) *MockClientDequeueCall
- func (mr *MockClientMockRecorder) Enqueue(arg0, arg1 any, arg2 ...any) *MockClientEnqueueCall
- func (mr *MockClientMockRecorder) ExtendMessage(arg0, arg1 any) *MockClientExtendMessageCall
- func (mr *MockClientMockRecorder) FinishMessage(arg0, arg1 any) *MockClientFinishMessageCall
- 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 MockClientDequeueCall ¶ added in v0.35.0
MockClientDequeueCall wrap *gomock.Call
func (*MockClientDequeueCall) Do ¶ added in v0.35.0
func (c *MockClientDequeueCall) Do(f func(context.Context, QueueClientConfig) (*Message, error)) *MockClientDequeueCall
Do rewrite *gomock.Call.Do
func (*MockClientDequeueCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientDequeueCall) DoAndReturn(f func(context.Context, QueueClientConfig) (*Message, error)) *MockClientDequeueCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientDequeueCall) Return ¶ added in v0.35.0
func (c *MockClientDequeueCall) Return(arg0 *Message, arg1 error) *MockClientDequeueCall
Return rewrite *gomock.Call.Return
type MockClientEnqueueCall ¶ added in v0.35.0
MockClientEnqueueCall wrap *gomock.Call
func (*MockClientEnqueueCall) Do ¶ added in v0.35.0
func (c *MockClientEnqueueCall) Do(f func(context.Context, *Message, ...EnqueueOptions) error) *MockClientEnqueueCall
Do rewrite *gomock.Call.Do
func (*MockClientEnqueueCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientEnqueueCall) DoAndReturn(f func(context.Context, *Message, ...EnqueueOptions) error) *MockClientEnqueueCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientEnqueueCall) Return ¶ added in v0.35.0
func (c *MockClientEnqueueCall) Return(arg0 error) *MockClientEnqueueCall
Return rewrite *gomock.Call.Return
type MockClientExtendMessageCall ¶ added in v0.35.0
MockClientExtendMessageCall wrap *gomock.Call
func (*MockClientExtendMessageCall) Do ¶ added in v0.35.0
func (c *MockClientExtendMessageCall) Do(f func(context.Context, *Message) error) *MockClientExtendMessageCall
Do rewrite *gomock.Call.Do
func (*MockClientExtendMessageCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientExtendMessageCall) DoAndReturn(f func(context.Context, *Message) error) *MockClientExtendMessageCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientExtendMessageCall) Return ¶ added in v0.35.0
func (c *MockClientExtendMessageCall) Return(arg0 error) *MockClientExtendMessageCall
Return rewrite *gomock.Call.Return
type MockClientFinishMessageCall ¶ added in v0.35.0
MockClientFinishMessageCall wrap *gomock.Call
func (*MockClientFinishMessageCall) Do ¶ added in v0.35.0
func (c *MockClientFinishMessageCall) Do(f func(context.Context, *Message) error) *MockClientFinishMessageCall
Do rewrite *gomock.Call.Do
func (*MockClientFinishMessageCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientFinishMessageCall) DoAndReturn(f func(context.Context, *Message) error) *MockClientFinishMessageCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientFinishMessageCall) Return ¶ added in v0.35.0
func (c *MockClientFinishMessageCall) Return(arg0 error) *MockClientFinishMessageCall
Return rewrite *gomock.Call.Return
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 any) *MockClientDequeueCall
Dequeue indicates an expected call of Dequeue.
func (*MockClientMockRecorder) Enqueue ¶
func (mr *MockClientMockRecorder) Enqueue(arg0, arg1 any, arg2 ...any) *MockClientEnqueueCall
Enqueue indicates an expected call of Enqueue.
func (*MockClientMockRecorder) ExtendMessage ¶
func (mr *MockClientMockRecorder) ExtendMessage(arg0, arg1 any) *MockClientExtendMessageCall
ExtendMessage indicates an expected call of ExtendMessage.
func (*MockClientMockRecorder) FinishMessage ¶
func (mr *MockClientMockRecorder) FinishMessage(arg0, arg1 any) *MockClientFinishMessageCall
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().