Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBuilder ¶
func NewBuilder(eventType string) *builder
NewBuilder returns new builder instance
Types ¶
type BackOffConfig ¶
type BackOffConfig struct { InitialBackoffMs int BackoffMultiplier int BackoffRandomFactor float32 }
BackOffConfig represents backoff configuration
type Backoff ¶
type Backoff struct {
// contains filtered or unexported fields
}
Backoff represents exponential backoff
func NewBackoff ¶
func NewBackoff(config *BackOffConfig) *Backoff
NewBackoff creates new backoff object
func (*Backoff) NextBackoffMs ¶
NextBackoffMs returns next backoff time in milisecond
func (*Backoff) ResetSleepBackoff ¶
func (backoff *Backoff) ResetSleepBackoff()
ResetSleepBackoff resets backoff
func (*Backoff) SleepBackoff ¶
func (backoff *Backoff) SleepBackoff()
SleepBackoff sleeps using backoff delay
type Backoffer ¶
type Backoffer interface { SleepBackoff() ResetSleepBackoff() }
Backoffer represents backoff algorithm interface
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer represents consumer
func NewConsumer ¶
func NewConsumer(readGroup string, driver ConsumerDriver, config *ConsumerConfig) *Consumer
NewConsumer creates new consumer
func (*Consumer) CloseAndWait ¶
func (consumer *Consumer) CloseAndWait()
CloseAndWait closes consumer and wait it to be done
type ConsumerConfig ¶
ConsumerConfig represents consumer configuration
type ConsumerDriver ¶
type ConsumerDriver interface { Fetch(readGroup string, limit int) ([]*Event, error) CommitInTrans(readGroup string, event *Event, handler func() error) error WaitChange(timeout time.Duration) }
ConsumerDriver represents event consumer driver
type Event ¶
type Event struct { ID uint `xorm:"pk 'id'"` Type string `xorm:"type" gorm:"not null"` AggregateType string `xorm:"aggregate_type"` AggregateID string `xorm:"aggregate_id"` Data JSON CreatedAt *time.Time `xorm:"created_at"` }
Event represents event data
type JSON ¶
type JSON json.RawMessage
JSON custom data type
type MockBackoffer ¶
MockBackoffer is an autogenerated mock type for the Backoffer type
func (*MockBackoffer) ResetSleepBackoff ¶
func (_m *MockBackoffer) ResetSleepBackoff()
ResetSleepBackoff provides a mock function with given fields:
func (*MockBackoffer) SleepBackoff ¶
func (_m *MockBackoffer) SleepBackoff()
SleepBackoff provides a mock function with given fields:
type MockConsumerDriver ¶
MockConsumerDriver is an autogenerated mock type for the ConsumerDriver type
func (*MockConsumerDriver) CommitInTrans ¶
func (_m *MockConsumerDriver) CommitInTrans(readGroup string, event *Event, handler func() error) error
CommitInTrans provides a mock function with given fields: readGroup, event, handler
func (*MockConsumerDriver) Fetch ¶
func (_m *MockConsumerDriver) Fetch(readGroup string, limit int) ([]*Event, error)
Fetch provides a mock function with given fields: readGroup, limit
func (*MockConsumerDriver) WaitChange ¶
func (_m *MockConsumerDriver) WaitChange(timeout time.Duration)
WaitChange provides a mock function with given fields: timeout
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store represents event store
func (*Store) NewConsumer ¶
func (store *Store) NewConsumer(readGroup string, config *ConsumerConfig) *Consumer
NewConsumer creates new consumer for store
type StoreDriver ¶
type StoreDriver interface { Provision() error Create(events ...*Event) error Close() error ConsumerDriver }
StoreDriver represents event store driver