eventhub

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package eventhub is a generated GoMock package.

Package eventhub is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoMsgReceived = errors.New("no message received")
	ErrTopicMismatch = errors.New("topic should be same as Event Hub name")
)

Functions

This section is empty.

Types

type Client

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

func New

func New(cfg Config) *Client

New Creates the client for Event Hub.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect()

Connect establishes a connection to Cassandra and registers metrics using the provided configuration when the client was Created.

func (*Client) CreateTopic

func (c *Client) CreateTopic(context.Context, string) error

func (*Client) DeleteTopic

func (c *Client) DeleteTopic(context.Context, string) error

func (*Client) Health

func (c *Client) Health() datasource.Health

func (*Client) Publish

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

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, topic string) (*pubsub.Message, error)

Subscribe checks all partitions for the first available event and returns it.

func (*Client) UseLogger

func (c *Client) UseLogger(logger any)

UseLogger sets the logger for the Event Hub client.

func (*Client) UseMetrics

func (c *Client) UseMetrics(metrics any)

UseMetrics sets the metrics for the Event Hub client.

func (*Client) UseTracer

func (c *Client) UseTracer(tracer any)

UseTracer sets the tracer for the Event Hub client.

type Config

type Config struct {
	ConnectionString          string
	ContainerConnectionString string
	StorageServiceURL         string
	StorageContainerName      string
	EventhubName              string
	// if not provided, it will read from the $Default consumergroup.
	ConsumerGroup string
	// the following configs are for advance setup of the Event Hub.
	StorageOptions   *container.ClientOptions
	BlobStoreOptions *checkpoints.BlobStoreOptions
	ConsumerOptions  *azeventhubs.ConsumerClientOptions
	ProducerOptions  *azeventhubs.ProducerClientOptions
}

type Log

type Log struct {
	Mode          string `json:"mode"`
	MessageValue  string `json:"messageValue"`
	Topic         string `json:"topic"`
	Host          string `json:"host"`
	PubSubBackend string `json:"pubSubBackend"`
	Time          int64  `json:"time"`
}

func (*Log) PrettyPrint

func (l *Log) PrettyPrint(writer io.Writer)

type Logger

type Logger interface {
	Debug(args ...interface{})
	Debugf(pattern string, args ...interface{})
	Log(args ...interface{})
	Logf(pattern string, args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Errorf(pattern string, args ...interface{})
}

Logger interface with required methods.

type Message

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

func (*Message) Commit

func (a *Message) Commit()

type Metrics

type Metrics interface {
	IncrementCounter(ctx context.Context, name string, labels ...string)
}

type MockLogger

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

MockLogger is a mock of Logger interface.

func NewMockLogger

func NewMockLogger(ctrl *gomock.Controller) *MockLogger

NewMockLogger creates a new mock instance.

func (*MockLogger) Debug

func (m *MockLogger) Debug(args ...any)

Debug mocks base method.

func (*MockLogger) Debugf

func (m *MockLogger) Debugf(pattern string, args ...any)

Debugf mocks base method.

func (*MockLogger) EXPECT

func (m *MockLogger) EXPECT() *MockLoggerMockRecorder

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

func (*MockLogger) Error

func (m *MockLogger) Error(args ...any)

Error mocks base method.

func (*MockLogger) Errorf

func (m *MockLogger) Errorf(pattern string, args ...any)

Errorf mocks base method.

func (*MockLogger) Fatal

func (m *MockLogger) Fatal(args ...any)

Fatal mocks base method.

func (*MockLogger) Log

func (m *MockLogger) Log(args ...any)

Log mocks base method.

func (*MockLogger) Logf

func (m *MockLogger) Logf(pattern string, args ...any)

Logf mocks base method.

type MockLoggerMockRecorder

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

MockLoggerMockRecorder is the mock recorder for MockLogger.

func (*MockLoggerMockRecorder) Debug

func (mr *MockLoggerMockRecorder) Debug(args ...any) *gomock.Call

Debug indicates an expected call of Debug.

func (*MockLoggerMockRecorder) Debugf

func (mr *MockLoggerMockRecorder) Debugf(pattern any, args ...any) *gomock.Call

Debugf indicates an expected call of Debugf.

func (*MockLoggerMockRecorder) Error

func (mr *MockLoggerMockRecorder) Error(args ...any) *gomock.Call

Error indicates an expected call of Error.

func (*MockLoggerMockRecorder) Errorf

func (mr *MockLoggerMockRecorder) Errorf(pattern any, args ...any) *gomock.Call

Errorf indicates an expected call of Errorf.

func (*MockLoggerMockRecorder) Fatal

func (mr *MockLoggerMockRecorder) Fatal(args ...any) *gomock.Call

Fatal indicates an expected call of Fatal.

func (*MockLoggerMockRecorder) Log

func (mr *MockLoggerMockRecorder) Log(args ...any) *gomock.Call

Log indicates an expected call of Log.

func (*MockLoggerMockRecorder) Logf

func (mr *MockLoggerMockRecorder) Logf(pattern any, args ...any) *gomock.Call

Logf indicates an expected call of Logf.

type MockMetrics

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

MockMetrics is a mock of Metrics interface.

func NewMockMetrics

func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics

NewMockMetrics creates a new mock instance.

func (*MockMetrics) EXPECT

func (m *MockMetrics) EXPECT() *MockMetricsMockRecorder

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

func (*MockMetrics) IncrementCounter

func (m *MockMetrics) IncrementCounter(ctx context.Context, name string, labels ...string)

IncrementCounter mocks base method.

type MockMetricsMockRecorder

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

MockMetricsMockRecorder is the mock recorder for MockMetrics.

func (*MockMetricsMockRecorder) IncrementCounter

func (mr *MockMetricsMockRecorder) IncrementCounter(ctx, name any, labels ...any) *gomock.Call

IncrementCounter indicates an expected call of IncrementCounter.

Jump to

Keyboard shortcuts

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