eventrunner

package
v0.0.0-...-a31e093 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package eventrunner pkg/eventrunner/buffer.go

Package eventrunner pkg/eventrunner/consumer_manager.go

Package eventrunner pkg/eventrunner/interfaces.go

Package eventrunner is a generated GoMock package.

Package eventrunner pkg/eventrunner/router.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppInterface

type AppInterface interface {
	Subscribe(topic string, handler gofr.SubscribeFunc)
	Run()
	Logger() logging.Logger
	Metrics() metrics.Manager
	AddPubSub(ctx context.Context, pubsub container.PubSubProvider) error
	AddCassandra(ctx context.Context, cassandraClient container.CassandraProvider) error
	AddMongo(ctx context.Context, mongoClient container.MongoProvider) error
	Migrate(migrationsMap map[int64]migration.Migrate)
}

type AppWrapper

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

AppWrapper wraps a *gofr.App and implements AppInterface.

func NewAppWrapper

func NewAppWrapper(app *gofr.App) *AppWrapper

func (*AppWrapper) AddCassandra

func (a *AppWrapper) AddCassandra(ctx context.Context, cassandraClient container.CassandraProvider) error

func (*AppWrapper) AddMongo

func (a *AppWrapper) AddMongo(ctx context.Context, mongoClient container.MongoProvider) error

func (*AppWrapper) AddPubSub

func (a *AppWrapper) AddPubSub(ctx context.Context, pubsubClient container.PubSubProvider) error

func (*AppWrapper) Logger

func (a *AppWrapper) Logger() logging.Logger

func (*AppWrapper) Metrics

func (a *AppWrapper) Metrics() metrics.Manager

func (*AppWrapper) Migrate

func (a *AppWrapper) Migrate(migrationsMap map[int64]migration.Migrate)

func (*AppWrapper) Run

func (a *AppWrapper) Run()

func (*AppWrapper) Subscribe

func (a *AppWrapper) Subscribe(topic string, handler gofr.SubscribeFunc)

type Buffer

type Buffer interface {
	io.Writer
	Bytes() []byte
	Reset()
}

type CassandraEventSink

type CassandraEventSink struct{}

func NewCassandraEventSink

func NewCassandraEventSink() *CassandraEventSink

func (*CassandraEventSink) ConsumeEvent

func (*CassandraEventSink) ConsumeEvent(ctx *gofr.Context, event *cloudevents.Event) error

type CassandraInsertError

type CassandraInsertError struct {
	OriginalError error
}

CassandraInsertError is a custom error type for Cassandra insertion errors.

func (*CassandraInsertError) Error

func (cie *CassandraInsertError) Error() string

Error implements the error interface for CassandraInsertError.

func (*CassandraInsertError) Unwrap

func (cie *CassandraInsertError) Unwrap() error

Unwrap allows errors.Is and errors.As to work with CassandraInsertError.

type ConsumerErrors

type ConsumerErrors struct {
	Errors []error
}

ConsumerErrors is a custom error type that holds multiple errors.

func (*ConsumerErrors) Error

func (ce *ConsumerErrors) Error() string

Error implements the error interface for ConsumerErrors.

type ConsumerManager

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

func NewConsumerManager

func NewConsumerManager(app AppInterface, logger pubsub.Logger) *ConsumerManager

func (*ConsumerManager) AddConsumer

func (cm *ConsumerManager) AddConsumer(name string, consumer EventConsumer)

func (*ConsumerManager) ConsumeEvent

func (cm *ConsumerManager) ConsumeEvent(c *gofr.Context, event *cloudevents.Event) error

type EventConsumer

type EventConsumer interface {
	ConsumeEvent(ctx *gofr.Context, event *cloudevents.Event) error
}

type EventRouter

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

func NewEventRouter

func NewEventRouter(
	ctx context.Context, app AppInterface, natsClient NATSClient, cassandraClient *cassandraPkg.Client) *EventRouter

func (*EventRouter) Start

func (er *EventRouter) Start()

func (*EventRouter) Use

func (er *EventRouter) Use(middleware Middleware)

type EventSink

type EventSink interface {
	LogEvent(context.Context, *cloudevents.Event) error
}

type HandlerFunc

type HandlerFunc func(*gofr.Context, *cloudevents.Event) error

type LogEventSink

type LogEventSink struct {
}

func (*LogEventSink) LogEvent

type Middleware

type Middleware func(HandlerFunc) HandlerFunc

type MockAppInterface

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

MockAppInterface is a mock of AppInterface interface.

func NewMockAppInterface

func NewMockAppInterface(ctrl *gomock.Controller) *MockAppInterface

NewMockAppInterface creates a new mock instance.

func (*MockAppInterface) AddCassandra

func (m *MockAppInterface) AddCassandra(cassandraClient container.CassandraProvider)

AddCassandra mocks base method.

func (*MockAppInterface) AddPubSub

func (m *MockAppInterface) AddPubSub(pubsub container.PubSubProvider)

AddPubSub mocks base method.

func (*MockAppInterface) EXPECT

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

func (*MockAppInterface) Logger

func (m *MockAppInterface) Logger() logging.Logger

Logger mocks base method.

func (*MockAppInterface) Metrics

func (m *MockAppInterface) Metrics() metrics.Manager

Metrics mocks base method.

func (*MockAppInterface) Migrate

func (m *MockAppInterface) Migrate(migrationsMap map[int64]migration.Migrate)

Migrate mocks base method.

func (*MockAppInterface) Run

func (m *MockAppInterface) Run()

Run mocks base method.

func (*MockAppInterface) Subscribe

func (m *MockAppInterface) Subscribe(topic string, handler gofr.SubscribeFunc)

Subscribe mocks base method.

type MockAppInterfaceMockRecorder

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

MockAppInterfaceMockRecorder is the mock recorder for MockAppInterface.

func (*MockAppInterfaceMockRecorder) AddCassandra

func (mr *MockAppInterfaceMockRecorder) AddCassandra(cassandraClient any) *gomock.Call

AddCassandra indicates an expected call of AddCassandra.

func (*MockAppInterfaceMockRecorder) AddPubSub

func (mr *MockAppInterfaceMockRecorder) AddPubSub(pubsub any) *gomock.Call

AddPubSub indicates an expected call of AddPubSub.

func (*MockAppInterfaceMockRecorder) Logger

Logger indicates an expected call of Logger.

func (*MockAppInterfaceMockRecorder) Metrics

func (mr *MockAppInterfaceMockRecorder) Metrics() *gomock.Call

Metrics indicates an expected call of Metrics.

func (*MockAppInterfaceMockRecorder) Migrate

func (mr *MockAppInterfaceMockRecorder) Migrate(migrationsMap any) *gomock.Call

Migrate indicates an expected call of Migrate.

func (*MockAppInterfaceMockRecorder) Run

Run indicates an expected call of Run.

func (*MockAppInterfaceMockRecorder) Subscribe

func (mr *MockAppInterfaceMockRecorder) Subscribe(topic, handler any) *gomock.Call

Subscribe indicates an expected call of Subscribe.

type MockBuffer

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

MockBuffer is a mock of Buffer interface.

func NewMockBuffer

func NewMockBuffer(ctrl *gomock.Controller) *MockBuffer

NewMockBuffer creates a new mock instance.

func (*MockBuffer) Bytes

func (m *MockBuffer) Bytes() []byte

Bytes mocks base method.

func (*MockBuffer) EXPECT

func (m *MockBuffer) EXPECT() *MockBufferMockRecorder

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

func (*MockBuffer) Reset

func (m *MockBuffer) Reset()

Reset mocks base method.

func (*MockBuffer) Write

func (m *MockBuffer) Write(p []byte) (int, error)

Write mocks base method.

type MockBufferMockRecorder

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

MockBufferMockRecorder is the mock recorder for MockBuffer.

func (*MockBufferMockRecorder) Bytes

func (mr *MockBufferMockRecorder) Bytes() *gomock.Call

Bytes indicates an expected call of Bytes.

func (*MockBufferMockRecorder) Reset

func (mr *MockBufferMockRecorder) Reset() *gomock.Call

Reset indicates an expected call of Reset.

func (*MockBufferMockRecorder) Write

func (mr *MockBufferMockRecorder) Write(p any) *gomock.Call

Write indicates an expected call of Write.

type MockEventConsumer

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

MockEventConsumer is a mock of EventConsumer interface.

func NewMockEventConsumer

func NewMockEventConsumer(ctrl *gomock.Controller) *MockEventConsumer

NewMockEventConsumer creates a new mock instance.

func (*MockEventConsumer) ConsumeEvent

func (m *MockEventConsumer) ConsumeEvent(ctx *gofr.Context, event *v2.Event) error

ConsumeEvent mocks base method.

func (*MockEventConsumer) EXPECT

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

type MockEventConsumerMockRecorder

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

MockEventConsumerMockRecorder is the mock recorder for MockEventConsumer.

func (*MockEventConsumerMockRecorder) ConsumeEvent

func (mr *MockEventConsumerMockRecorder) ConsumeEvent(ctx, event any) *gomock.Call

ConsumeEvent indicates an expected call of ConsumeEvent.

type MockEventSink

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

MockEventSink is a mock of EventSink interface.

func NewMockEventSink

func NewMockEventSink(ctrl *gomock.Controller) *MockEventSink

NewMockEventSink creates a new mock instance.

func (*MockEventSink) EXPECT

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

func (*MockEventSink) LogEvent

func (m *MockEventSink) LogEvent(arg0 context.Context, arg1 *v2.Event) error

LogEvent mocks base method.

type MockEventSinkMockRecorder

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

MockEventSinkMockRecorder is the mock recorder for MockEventSink.

func (*MockEventSinkMockRecorder) LogEvent

func (mr *MockEventSinkMockRecorder) LogEvent(arg0, arg1 any) *gomock.Call

LogEvent indicates an expected call of LogEvent.

type MockNATSClient

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

MockNATSClient is a mock of NATSClient interface.

func NewMockNATSClient

func NewMockNATSClient(ctrl *gomock.Controller) *MockNATSClient

NewMockNATSClient creates a new mock instance.

func (*MockNATSClient) Close

func (m *MockNATSClient) Close(ctx context.Context) error

Close mocks base method.

func (*MockNATSClient) Connect

func (m *MockNATSClient) Connect() error

Connect mocks base method.

func (*MockNATSClient) CreateTopic

func (m *MockNATSClient) CreateTopic(ctx context.Context, name string) error

CreateTopic mocks base method.

func (*MockNATSClient) DeleteTopic

func (m *MockNATSClient) DeleteTopic(ctx context.Context, name string) error

DeleteTopic mocks base method.

func (*MockNATSClient) EXPECT

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

func (*MockNATSClient) Health

func (m *MockNATSClient) Health() datasource.Health

Health mocks base method.

func (*MockNATSClient) Publish

func (m *MockNATSClient) Publish(ctx context.Context, topic string, message []byte) error

Publish mocks base method.

func (*MockNATSClient) Subscribe

func (m *MockNATSClient) Subscribe(ctx context.Context, topic string) (*pubsub.Message, error)

Subscribe mocks base method.

func (*MockNATSClient) UseLogger

func (m *MockNATSClient) UseLogger(logger any)

UseLogger mocks base method.

func (*MockNATSClient) UseMetrics

func (m *MockNATSClient) UseMetrics(metrics any)

UseMetrics mocks base method.

func (*MockNATSClient) UseTracer

func (m *MockNATSClient) UseTracer(tracer any)

UseTracer mocks base method.

type MockNATSClientMockRecorder

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

MockNATSClientMockRecorder is the mock recorder for MockNATSClient.

func (*MockNATSClientMockRecorder) Close

func (mr *MockNATSClientMockRecorder) Close(ctx any) *gomock.Call

Close indicates an expected call of Close.

func (*MockNATSClientMockRecorder) Connect

func (mr *MockNATSClientMockRecorder) Connect() *gomock.Call

Connect indicates an expected call of Connect.

func (*MockNATSClientMockRecorder) CreateTopic

func (mr *MockNATSClientMockRecorder) CreateTopic(ctx, name any) *gomock.Call

CreateTopic indicates an expected call of CreateTopic.

func (*MockNATSClientMockRecorder) DeleteTopic

func (mr *MockNATSClientMockRecorder) DeleteTopic(ctx, name any) *gomock.Call

DeleteTopic indicates an expected call of DeleteTopic.

func (*MockNATSClientMockRecorder) Health

func (mr *MockNATSClientMockRecorder) Health() *gomock.Call

Health indicates an expected call of Health.

func (*MockNATSClientMockRecorder) Publish

func (mr *MockNATSClientMockRecorder) Publish(ctx, topic, message any) *gomock.Call

Publish indicates an expected call of Publish.

func (*MockNATSClientMockRecorder) Subscribe

func (mr *MockNATSClientMockRecorder) Subscribe(ctx, topic any) *gomock.Call

Subscribe indicates an expected call of Subscribe.

func (*MockNATSClientMockRecorder) UseLogger

func (mr *MockNATSClientMockRecorder) UseLogger(logger any) *gomock.Call

UseLogger indicates an expected call of UseLogger.

func (*MockNATSClientMockRecorder) UseMetrics

func (mr *MockNATSClientMockRecorder) UseMetrics(metrics any) *gomock.Call

UseMetrics indicates an expected call of UseMetrics.

func (*MockNATSClientMockRecorder) UseTracer

func (mr *MockNATSClientMockRecorder) UseTracer(tracer any) *gomock.Call

UseTracer indicates an expected call of UseTracer.

type NATSClient

type NATSClient interface {
	Publish(ctx context.Context, topic string, message []byte) error
	Subscribe(ctx context.Context, topic string) (*pubsub.Message, error)
	Connect(ctx context.Context) error
	Health() datasource.Health
	CreateTopic(ctx context.Context, name string) error
	DeleteTopic(ctx context.Context, name string) error
	Close() error
	UseLogger(logger any)
	UseMetrics(metrics any)
	UseTracer(tracer any)
}

Jump to

Keyboard shortcuts

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