Documentation ¶
Index ¶
- Constants
- type BatchProcessor
- type BatchProcessorImpl
- func (s *BatchProcessorImpl[T]) Start()
- func (s *BatchProcessorImpl[T]) Stop()
- func (s *BatchProcessorImpl[T]) WithFinalizer(finalizer Finalizer[T]) *BatchProcessorImpl[T]
- func (s *BatchProcessorImpl[T]) WithNoBatchSleepIntervalInMilliseconds(millis int64) *BatchProcessorImpl[T]
- func (s *BatchProcessorImpl[T]) WithProcessorTimeout(processorTimeoutMillis int64) *BatchProcessorImpl[T]
- type Finalizer
- type MockFinalizer
- type MockFinalizer_Expecter
- type MockFinalizer_OnBatchProcessed_Call
- func (_c *MockFinalizer_OnBatchProcessed_Call[T]) Return() *MockFinalizer_OnBatchProcessed_Call[T]
- func (_c *MockFinalizer_OnBatchProcessed_Call[T]) Run(run func(processedBatch []*T, err error)) *MockFinalizer_OnBatchProcessed_Call[T]
- func (_c *MockFinalizer_OnBatchProcessed_Call[T]) RunAndReturn(run func([]*T, error)) *MockFinalizer_OnBatchProcessed_Call[T]
- type MockProcessor
- type MockProcessor_Expecter
- type MockProcessor_ProcessBatch_Call
- func (_c *MockProcessor_ProcessBatch_Call[T]) Return(_a0 []*T, _a1 error) *MockProcessor_ProcessBatch_Call[T]
- func (_c *MockProcessor_ProcessBatch_Call[T]) Run(run func(ctx context.Context, batch []*T)) *MockProcessor_ProcessBatch_Call[T]
- func (_c *MockProcessor_ProcessBatch_Call[T]) RunAndReturn(run func(context.Context, []*T) ([]*T, error)) *MockProcessor_ProcessBatch_Call[T]
- type MockSupplier
- type MockSupplier_Expecter
- type MockSupplier_FetchNextBatch_Call
- func (_c *MockSupplier_FetchNextBatch_Call[T]) Return(_a0 []*T, _a1 error) *MockSupplier_FetchNextBatch_Call[T]
- func (_c *MockSupplier_FetchNextBatch_Call[T]) Run(run func()) *MockSupplier_FetchNextBatch_Call[T]
- func (_c *MockSupplier_FetchNextBatch_Call[T]) RunAndReturn(run func() ([]*T, error)) *MockSupplier_FetchNextBatch_Call[T]
- type Processor
- type Supplier
Constants ¶
const DefaultTimeout = time.Duration(2147483647) * time.Millisecond
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchProcessor ¶
type BatchProcessor[T any] interface { Start() Stop() }
type BatchProcessorImpl ¶
type BatchProcessorImpl[T any] struct { // contains filtered or unexported fields }
func NewBatchProcessorImpl ¶
func NewBatchProcessorImpl[T any](maxWorkersCount int, supplier Supplier[T], processor Processor[T]) *BatchProcessorImpl[T]
func (*BatchProcessorImpl[T]) Start ¶
func (s *BatchProcessorImpl[T]) Start()
func (*BatchProcessorImpl[T]) Stop ¶
func (s *BatchProcessorImpl[T]) Stop()
Stop /* Stops the processor. It will wait until all the processing is finished.
func (*BatchProcessorImpl[T]) WithFinalizer ¶
func (s *BatchProcessorImpl[T]) WithFinalizer(finalizer Finalizer[T]) *BatchProcessorImpl[T]
WithFinalizer /* Finalizers are useful if there is a need to run code after the batch is processed
func (*BatchProcessorImpl[T]) WithNoBatchSleepIntervalInMilliseconds ¶
func (s *BatchProcessorImpl[T]) WithNoBatchSleepIntervalInMilliseconds(millis int64) *BatchProcessorImpl[T]
WithNoBatchSleepIntervalInMilliseconds /* For how long should the processor wait before trying to get the next batch of messages in case the previous fetch was empty
func (*BatchProcessorImpl[T]) WithProcessorTimeout ¶
func (s *BatchProcessorImpl[T]) WithProcessorTimeout(processorTimeoutMillis int64) *BatchProcessorImpl[T]
type MockFinalizer ¶
MockFinalizer is an autogenerated mock type for the Finalizer type
func NewMockFinalizer ¶
func NewMockFinalizer[T interface{}](t interface { mock.TestingT Cleanup(func()) }) *MockFinalizer[T]
NewMockFinalizer creates a new instance of MockFinalizer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockFinalizer[T]) EXPECT ¶
func (_m *MockFinalizer[T]) EXPECT() *MockFinalizer_Expecter[T]
func (*MockFinalizer[T]) OnBatchProcessed ¶
func (_m *MockFinalizer[T]) OnBatchProcessed(processedBatch []*T, err error)
OnBatchProcessed provides a mock function with given fields: processedBatch, err
type MockFinalizer_Expecter ¶
type MockFinalizer_Expecter[T interface{}] struct {
// contains filtered or unexported fields
}
func (*MockFinalizer_Expecter[T]) OnBatchProcessed ¶
func (_e *MockFinalizer_Expecter[T]) OnBatchProcessed(processedBatch interface{}, err interface{}) *MockFinalizer_OnBatchProcessed_Call[T]
OnBatchProcessed is a helper method to define mock.On call
- processedBatch []*T
- err error
type MockFinalizer_OnBatchProcessed_Call ¶
MockFinalizer_OnBatchProcessed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnBatchProcessed'
func (*MockFinalizer_OnBatchProcessed_Call[T]) Return ¶
func (_c *MockFinalizer_OnBatchProcessed_Call[T]) Return() *MockFinalizer_OnBatchProcessed_Call[T]
func (*MockFinalizer_OnBatchProcessed_Call[T]) Run ¶
func (_c *MockFinalizer_OnBatchProcessed_Call[T]) Run(run func(processedBatch []*T, err error)) *MockFinalizer_OnBatchProcessed_Call[T]
func (*MockFinalizer_OnBatchProcessed_Call[T]) RunAndReturn ¶
func (_c *MockFinalizer_OnBatchProcessed_Call[T]) RunAndReturn(run func([]*T, error)) *MockFinalizer_OnBatchProcessed_Call[T]
type MockProcessor ¶
MockProcessor is an autogenerated mock type for the Processor type
func NewMockProcessor ¶
func NewMockProcessor[T interface{}](t interface { mock.TestingT Cleanup(func()) }) *MockProcessor[T]
NewMockProcessor creates a new instance of MockProcessor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockProcessor[T]) EXPECT ¶
func (_m *MockProcessor[T]) EXPECT() *MockProcessor_Expecter[T]
func (*MockProcessor[T]) ProcessBatch ¶
func (_m *MockProcessor[T]) ProcessBatch(ctx context.Context, batch []*T) ([]*T, error)
ProcessBatch provides a mock function with given fields: ctx, batch
type MockProcessor_Expecter ¶
type MockProcessor_Expecter[T interface{}] struct {
// contains filtered or unexported fields
}
func (*MockProcessor_Expecter[T]) ProcessBatch ¶
func (_e *MockProcessor_Expecter[T]) ProcessBatch(ctx interface{}, batch interface{}) *MockProcessor_ProcessBatch_Call[T]
ProcessBatch is a helper method to define mock.On call
- ctx context.Context
- batch []*T
type MockProcessor_ProcessBatch_Call ¶
MockProcessor_ProcessBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessBatch'
func (*MockProcessor_ProcessBatch_Call[T]) Return ¶
func (_c *MockProcessor_ProcessBatch_Call[T]) Return(_a0 []*T, _a1 error) *MockProcessor_ProcessBatch_Call[T]
func (*MockProcessor_ProcessBatch_Call[T]) Run ¶
func (_c *MockProcessor_ProcessBatch_Call[T]) Run(run func(ctx context.Context, batch []*T)) *MockProcessor_ProcessBatch_Call[T]
func (*MockProcessor_ProcessBatch_Call[T]) RunAndReturn ¶
func (_c *MockProcessor_ProcessBatch_Call[T]) RunAndReturn(run func(context.Context, []*T) ([]*T, error)) *MockProcessor_ProcessBatch_Call[T]
type MockSupplier ¶
MockSupplier is an autogenerated mock type for the Supplier type
func NewMockSupplier ¶
func NewMockSupplier[T interface{}](t interface { mock.TestingT Cleanup(func()) }) *MockSupplier[T]
NewMockSupplier creates a new instance of MockSupplier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockSupplier[T]) EXPECT ¶
func (_m *MockSupplier[T]) EXPECT() *MockSupplier_Expecter[T]
func (*MockSupplier[T]) FetchNextBatch ¶
func (_m *MockSupplier[T]) FetchNextBatch() ([]*T, error)
FetchNextBatch provides a mock function with given fields:
type MockSupplier_Expecter ¶
type MockSupplier_Expecter[T interface{}] struct {
// contains filtered or unexported fields
}
func (*MockSupplier_Expecter[T]) FetchNextBatch ¶
func (_e *MockSupplier_Expecter[T]) FetchNextBatch() *MockSupplier_FetchNextBatch_Call[T]
FetchNextBatch is a helper method to define mock.On call
type MockSupplier_FetchNextBatch_Call ¶
MockSupplier_FetchNextBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FetchNextBatch'
func (*MockSupplier_FetchNextBatch_Call[T]) Return ¶
func (_c *MockSupplier_FetchNextBatch_Call[T]) Return(_a0 []*T, _a1 error) *MockSupplier_FetchNextBatch_Call[T]
func (*MockSupplier_FetchNextBatch_Call[T]) Run ¶
func (_c *MockSupplier_FetchNextBatch_Call[T]) Run(run func()) *MockSupplier_FetchNextBatch_Call[T]
func (*MockSupplier_FetchNextBatch_Call[T]) RunAndReturn ¶
func (_c *MockSupplier_FetchNextBatch_Call[T]) RunAndReturn(run func() ([]*T, error)) *MockSupplier_FetchNextBatch_Call[T]