eventbus

package
v0.0.0-...-da8027b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package eventbus is a generated GoMock package.

Package eventbus is a generated GoMock package.

Package eventbus is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelBuilder

func ChannelBuilder(st stream.Type) string

func Filter

func Filter(events ...stream.EventType) func(stream.EventType) bool

Types

type Bus

type Bus interface {
	Subscriber
	Publisher
}

func New

func New(p Publisher, s Subscriber, o ...Option) Bus

type Duplicator

type Duplicator interface {
	Has(context.Context, stream.Event) bool
	Ensure(context.Context, stream.Event) error
}

func NewNopDuplicator

func NewNopDuplicator() Duplicator

type Envelope

type Envelope struct {
	// contains filtered or unexported fields
}

func NewEnvelope

func NewEnvelope(c codec.Codec) *Envelope

func (*Envelope) Decode

func (env *Envelope) Decode(ctx context.Context, bytes []byte) (stream.Event, error)

func (*Envelope) Encode

func (env *Envelope) Encode(ctx context.Context, e stream.Event) ([]byte, error)

type Error

type Error struct {
	StreamType stream.Type
	StreamID   stream.ID
	EventType  stream.EventType
	Err        error
}

func (*Error) Error

func (e *Error) Error() string

type Handler

type Handler interface {
	MatchEvent(context.Context, stream.EventType) bool
	HandleEvent(context.Context, stream.Event) error
}

type HandlerCollector

type HandlerCollector struct {
	// contains filtered or unexported fields
}

func (*HandlerCollector) HandleEvent

func (c *HandlerCollector) HandleEvent(ctx context.Context, e stream.Event) (err error)

func (*HandlerCollector) MatchEvent

func (c *HandlerCollector) MatchEvent(ctx context.Context, et stream.EventType) bool

type HandlerFunc

type HandlerFunc func(context.Context, stream.Event) error

func (HandlerFunc) HandleEvent

func (h HandlerFunc) HandleEvent(ctx context.Context, e stream.Event) error

func (HandlerFunc) MatchEvent

type HandlerMetrics

type HandlerMetrics struct {
	Counter   metrics.Counter
	Histogram metrics.Histogram
}

func (*HandlerMetrics) Observe

func (m *HandlerMetrics) Observe(st stream.Type, et stream.EventType, start time.Time)

type HandlerMiddleware

type HandlerMiddleware func(Handler) Handler

func NewHandlerCollector

func NewHandlerCollector(m *HandlerMetrics) HandlerMiddleware

func NewLogging

func NewLogging(logger log.Logger) HandlerMiddleware

type Logging

type Logging struct {
	// contains filtered or unexported fields
}

func (*Logging) HandleEvent

func (l *Logging) HandleEvent(ctx context.Context, e stream.Event) (err error)

func (*Logging) MatchEvent

func (l *Logging) MatchEvent(ctx context.Context, et stream.EventType) bool

type MockDuplicator

type MockDuplicator struct {
	// contains filtered or unexported fields
}

MockDuplicator is a mock of Duplicator interface

func NewMockDuplicator

func NewMockDuplicator(ctrl *gomock.Controller) *MockDuplicator

NewMockDuplicator creates a new mock instance

func (*MockDuplicator) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDuplicator) Ensure

func (m *MockDuplicator) Ensure(arg0 context.Context, arg1 stream.Event) error

Ensure mocks base method

func (*MockDuplicator) Has

func (m *MockDuplicator) Has(arg0 context.Context, arg1 stream.Event) bool

Has mocks base method

type MockDuplicatorMockRecorder

type MockDuplicatorMockRecorder struct {
	// contains filtered or unexported fields
}

MockDuplicatorMockRecorder is the mock recorder for MockDuplicator

func (*MockDuplicatorMockRecorder) Ensure

func (mr *MockDuplicatorMockRecorder) Ensure(arg0, arg1 interface{}) *gomock.Call

Ensure indicates an expected call of Ensure

func (*MockDuplicatorMockRecorder) Has

func (mr *MockDuplicatorMockRecorder) Has(arg0, arg1 interface{}) *gomock.Call

Has indicates an expected call of Has

type MockHandler

type MockHandler struct {
	// contains filtered or unexported fields
}

MockHandler is a mock of Handler interface

func NewMockHandler

func NewMockHandler(ctrl *gomock.Controller) *MockHandler

NewMockHandler creates a new mock instance

func (*MockHandler) EXPECT

func (m *MockHandler) EXPECT() *MockHandlerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockHandler) HandleEvent

func (m *MockHandler) HandleEvent(arg0 context.Context, arg1 stream.Event) error

HandleEvent mocks base method

func (*MockHandler) MatchEvent

func (m *MockHandler) MatchEvent(arg0 context.Context, arg1 stream.EventType) bool

MatchEvent mocks base method

type MockHandlerMockRecorder

type MockHandlerMockRecorder struct {
	// contains filtered or unexported fields
}

MockHandlerMockRecorder is the mock recorder for MockHandler

func (*MockHandlerMockRecorder) HandleEvent

func (mr *MockHandlerMockRecorder) HandleEvent(arg0, arg1 interface{}) *gomock.Call

HandleEvent indicates an expected call of HandleEvent

func (*MockHandlerMockRecorder) MatchEvent

func (mr *MockHandlerMockRecorder) MatchEvent(arg0, arg1 interface{}) *gomock.Call

MatchEvent indicates an expected call of MatchEvent

type MockPublisher

type MockPublisher struct {
	// contains filtered or unexported fields
}

MockPublisher is a mock of Publisher interface

func NewMockPublisher

func NewMockPublisher(ctrl *gomock.Controller) *MockPublisher

NewMockPublisher creates a new mock instance

func (*MockPublisher) Close

func (m *MockPublisher) Close() error

Close mocks base method

func (*MockPublisher) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockPublisher) Publish

func (m *MockPublisher) Publish(arg0 context.Context, arg1 stream.Event) error

Publish mocks base method

type MockPublisherMockRecorder

type MockPublisherMockRecorder struct {
	// contains filtered or unexported fields
}

MockPublisherMockRecorder is the mock recorder for MockPublisher

func (*MockPublisherMockRecorder) Close

func (mr *MockPublisherMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockPublisherMockRecorder) Publish

func (mr *MockPublisherMockRecorder) Publish(arg0, arg1 interface{}) *gomock.Call

Publish indicates an expected call of Publish

type MockSubscriber

type MockSubscriber struct {
	// contains filtered or unexported fields
}

MockSubscriber is a mock of Subscriber interface

func NewMockSubscriber

func NewMockSubscriber(ctrl *gomock.Controller) *MockSubscriber

NewMockSubscriber creates a new mock instance

func (*MockSubscriber) Close

func (m *MockSubscriber) Close() error

Close mocks base method

func (*MockSubscriber) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockSubscriber) Listen

func (m *MockSubscriber) Listen(arg0 context.Context) error

Listen mocks base method

func (*MockSubscriber) Subscribe

func (m *MockSubscriber) Subscribe(ctx context.Context, st stream.Type, h ...Handler) error

Subscribe mocks base method

func (*MockSubscriber) Subscriptions

func (m *MockSubscriber) Subscriptions() []string

Subscriptions mocks base method

func (*MockSubscriber) Unsubscribe

func (m *MockSubscriber) Unsubscribe(ctx context.Context, st ...stream.Type) error

Unsubscribe mocks base method

type MockSubscriberMockRecorder

type MockSubscriberMockRecorder struct {
	// contains filtered or unexported fields
}

MockSubscriberMockRecorder is the mock recorder for MockSubscriber

func (*MockSubscriberMockRecorder) Close

func (mr *MockSubscriberMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockSubscriberMockRecorder) Listen

func (mr *MockSubscriberMockRecorder) Listen(arg0 interface{}) *gomock.Call

Listen indicates an expected call of Listen

func (*MockSubscriberMockRecorder) Subscribe

func (mr *MockSubscriberMockRecorder) Subscribe(ctx, st interface{}, h ...interface{}) *gomock.Call

Subscribe indicates an expected call of Subscribe

func (*MockSubscriberMockRecorder) Subscriptions

func (mr *MockSubscriberMockRecorder) Subscriptions() *gomock.Call

Subscriptions indicates an expected call of Subscriptions

func (*MockSubscriberMockRecorder) Unsubscribe

func (mr *MockSubscriberMockRecorder) Unsubscribe(ctx interface{}, st ...interface{}) *gomock.Call

Unsubscribe indicates an expected call of Unsubscribe

type Option

type Option func(*bus)

func WithHandlerMiddleware

func WithHandlerMiddleware(m ...HandlerMiddleware) Option

func WithPublisherMiddleware

func WithPublisherMiddleware(m ...PublisherMiddleware) Option

type Publisher

type Publisher interface {
	Publish(context.Context, stream.Event) error
	Close() error
}

func NewPublisher

func NewPublisher(
	s messaging.Sender,
	e *Envelope,
	o ...PublisherOption,
) Publisher

type PublisherCollector

type PublisherCollector struct {
	// contains filtered or unexported fields
}

func (*PublisherCollector) Close

func (c *PublisherCollector) Close() error

func (*PublisherCollector) Publish

func (c *PublisherCollector) Publish(ctx context.Context, e stream.Event) (err error)

type PublisherMetrics

type PublisherMetrics struct {
	Counter   metrics.Counter
	Histogram metrics.Histogram
}

func (*PublisherMetrics) Observe

func (m *PublisherMetrics) Observe(st stream.Type, et stream.EventType, start time.Time)

type PublisherMiddleware

type PublisherMiddleware func(Publisher) Publisher

func NewPublisherCollector

func NewPublisherCollector(m *PublisherMetrics) PublisherMiddleware

type PublisherOption

type PublisherOption func(*publisher)

type Subscriber

type Subscriber interface {
	Subscriptions() []string
	Subscribe(ctx context.Context, st stream.Type, h ...Handler) error
	Unsubscribe(ctx context.Context, st ...stream.Type) error
	Listen(context.Context) error
	Close() error
}

func NewSubscriber

func NewSubscriber(
	r messaging.Receiver,
	e *Envelope,
	o ...SubscriberOption,
) Subscriber

type SubscriberOption

type SubscriberOption func(*subscriber)

func SubscriberDuplicator

func SubscriberDuplicator(i Duplicator) SubscriberOption

func SubscriberErrorHandler

func SubscriberErrorHandler(h messaging.ErrorHandler) SubscriberOption

Directories

Path Synopsis
Package pb is a generated protocol buffer package.
Package pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL