nats

package module
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package nats connector.go

Package nats is a generated GoMock package.

Package nats is a generated GoMock package.

Package nats is a generated GoMock package.

Package nats is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJetStreamStatus

func GetJetStreamStatus(ctx context.Context, js jetstream.JetStream) (string, error)

GetJetStreamStatus returns the status of the jStream connection.

Types

type Client

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

Client represents a Client for NATS jStream operations.

func (*Client) Close

func (c *Client) Close(ctx context.Context) error

Close closes the Client.

func (*Client) Connect

func (c *Client) Connect() error

Connect establishes a connection to NATS and sets up jStream.

func (*Client) CreateOrUpdateStream

func (c *Client) CreateOrUpdateStream(ctx context.Context, cfg *jetstream.StreamConfig) (jetstream.Stream, error)

CreateOrUpdateStream creates or updates a stream in NATS jStream.

func (*Client) CreateStream

func (c *Client) CreateStream(ctx context.Context, cfg StreamConfig) error

CreateStream creates a new stream in NATS jStream.

func (*Client) CreateTopic

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

CreateTopic creates a new topic (stream) in NATS jStream.

func (*Client) DeleteStream

func (c *Client) DeleteStream(ctx context.Context, name string) error

DeleteStream deletes a stream in NATS jStream.

func (*Client) DeleteTopic

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

DeleteTopic deletes a topic (stream) in NATS jStream.

func (*Client) Health

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

Health checks the health of the NATS connection.

func (*Client) Publish

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

Publish publishes a message to a topic.

func (*Client) Subscribe

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

Subscribe subscribes to a topic and returns a single message.

func (*Client) SubscribeWithHandler

func (c *Client) SubscribeWithHandler(ctx context.Context, subject string, handler messageHandler) error

func (*Client) UseLogger

func (c *Client) UseLogger(logger any)

UseLogger sets the logger for the NATS client.

func (*Client) UseMetrics

func (c *Client) UseMetrics(metrics any)

UseMetrics sets the metrics for the NATS client.

func (*Client) UseTracer

func (c *Client) UseTracer(tracer any)

UseTracer sets the tracer for the NATS client.

type Config

type Config struct {
	Server      string
	CredsFile   string
	Stream      StreamConfig
	Consumer    string
	MaxWait     time.Duration
	MaxPullWait int
}

Config defines the Client configuration.

type ConnInterface

type ConnInterface interface {
	Status() nats.Status
	Close()
	NATSConn() *nats.Conn
	JetStream() (jetstream.JetStream, error)
}

ConnInterface represents the main Client connection.

type ConnectionManager

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

func NewConnectionManager

func NewConnectionManager(
	cfg *Config,
	logger pubsub.Logger,
	natsConnector Connector,
	jetStreamCreator JetStreamCreator) *ConnectionManager

NewConnectionManager creates a new ConnectionManager.

func (*ConnectionManager) Close

func (cm *ConnectionManager) Close(ctx context.Context)

func (*ConnectionManager) Connect

func (cm *ConnectionManager) Connect() error

Connect establishes a connection to NATS and sets up JetStream.

func (*ConnectionManager) Health

func (cm *ConnectionManager) Health() datasource.Health

func (*ConnectionManager) Publish

func (cm *ConnectionManager) Publish(ctx context.Context, subject string, message []byte, metrics Metrics) error

type ConnectionManagerInterface

type ConnectionManagerInterface interface {
	Connect() error
	Close(ctx context.Context)
	Publish(ctx context.Context, subject string, message []byte, metrics Metrics) error
	Health() datasource.Health
	// contains filtered or unexported methods
}

ConnectionManagerInterface represents the main Client connection.

type Connector

type Connector interface {
	Connect(string, ...nats.Option) (ConnInterface, error)
}

Connector represents the main Client connection.

type DefaultJetStreamCreator

type DefaultJetStreamCreator struct{}

func (*DefaultJetStreamCreator) New

type JetStreamClient

type JetStreamClient interface {
	Publish(ctx context.Context, subject string, message []byte) error
	Subscribe(ctx context.Context, subject string, handler messageHandler) error
	Close(ctx context.Context) error
	DeleteStream(ctx context.Context, name string) error
	CreateStream(ctx context.Context, cfg StreamConfig) error
	CreateOrUpdateStream(ctx context.Context, cfg jetstream.StreamConfig) (jetstream.Stream, error)
	Health() datasource.Health
}

JetStreamClient represents the main Client jStream Client.

type JetStreamCreator

type JetStreamCreator interface {
	New(conn ConnInterface) (jetstream.JetStream, error)
}

JetStreamCreator represents the main Client jStream Client.

type Metrics

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

Metrics represents the metrics interface.

type MockConnInterface

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

MockConnInterface is a mock of ConnInterface interface.

func NewMockConnInterface

func NewMockConnInterface(ctrl *gomock.Controller) *MockConnInterface

NewMockConnInterface creates a new mock instance.

func (*MockConnInterface) Close

func (m *MockConnInterface) Close()

Close mocks base method.

func (*MockConnInterface) EXPECT

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

func (*MockConnInterface) JetStream

func (m *MockConnInterface) JetStream() (jetstream.JetStream, error)

JetStream mocks base method.

func (*MockConnInterface) NATSConn

func (m *MockConnInterface) NATSConn() *nats.Conn

NATSConn mocks base method.

func (*MockConnInterface) Status

func (m *MockConnInterface) Status() nats.Status

Status mocks base method.

type MockConnInterfaceMockRecorder

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

MockConnInterfaceMockRecorder is the mock recorder for MockConnInterface.

func (*MockConnInterfaceMockRecorder) Close

Close indicates an expected call of Close.

func (*MockConnInterfaceMockRecorder) JetStream

func (mr *MockConnInterfaceMockRecorder) JetStream() *gomock.Call

JetStream indicates an expected call of JetStream.

func (*MockConnInterfaceMockRecorder) NATSConn

func (mr *MockConnInterfaceMockRecorder) NATSConn() *gomock.Call

NATSConn indicates an expected call of NATSConn.

func (*MockConnInterfaceMockRecorder) Status

Status indicates an expected call of Status.

type MockConnectionManagerInterface

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

MockConnectionManagerInterface is a mock of ConnectionManagerInterface interface.

func NewMockConnectionManagerInterface

func NewMockConnectionManagerInterface(ctrl *gomock.Controller) *MockConnectionManagerInterface

NewMockConnectionManagerInterface creates a new mock instance.

func (*MockConnectionManagerInterface) Close

Close mocks base method.

func (*MockConnectionManagerInterface) Connect

Connect mocks base method.

func (*MockConnectionManagerInterface) EXPECT

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

func (*MockConnectionManagerInterface) Health

Health mocks base method.

func (*MockConnectionManagerInterface) Publish

func (m *MockConnectionManagerInterface) Publish(ctx context.Context, subject string, message []byte, metrics Metrics) error

Publish mocks base method.

type MockConnectionManagerInterfaceMockRecorder

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

MockConnectionManagerInterfaceMockRecorder is the mock recorder for MockConnectionManagerInterface.

func (*MockConnectionManagerInterfaceMockRecorder) Close

Close indicates an expected call of Close.

func (*MockConnectionManagerInterfaceMockRecorder) Connect

Connect indicates an expected call of Connect.

func (*MockConnectionManagerInterfaceMockRecorder) Health

Health indicates an expected call of Health.

func (*MockConnectionManagerInterfaceMockRecorder) JetStream

JetStream indicates an expected call of JetStream.

func (*MockConnectionManagerInterfaceMockRecorder) Publish

func (mr *MockConnectionManagerInterfaceMockRecorder) Publish(ctx, subject, message, metrics any) *gomock.Call

Publish indicates an expected call of Publish.

type MockConsumer

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

MockConsumer is a mock of Consumer interface.

func NewMockConsumer

func NewMockConsumer(ctrl *gomock.Controller) *MockConsumer

NewMockConsumer creates a new mock instance.

func (*MockConsumer) CachedInfo

func (m *MockConsumer) CachedInfo() *jetstream.ConsumerInfo

CachedInfo mocks base method.

func (*MockConsumer) Consume

Consume mocks base method.

func (*MockConsumer) EXPECT

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

func (*MockConsumer) Fetch

func (m *MockConsumer) Fetch(batch int, opts ...jetstream.FetchOpt) (jetstream.MessageBatch, error)

Fetch mocks base method.

func (*MockConsumer) FetchBytes

func (m *MockConsumer) FetchBytes(maxBytes int, opts ...jetstream.FetchOpt) (jetstream.MessageBatch, error)

FetchBytes mocks base method.

func (*MockConsumer) FetchNoWait

func (m *MockConsumer) FetchNoWait(batch int) (jetstream.MessageBatch, error)

FetchNoWait mocks base method.

func (*MockConsumer) Info

Info mocks base method.

func (*MockConsumer) Messages

Messages mocks base method.

func (*MockConsumer) Next

func (m *MockConsumer) Next(opts ...jetstream.FetchOpt) (jetstream.Msg, error)

Next mocks base method.

type MockConsumerMockRecorder

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

MockConsumerMockRecorder is the mock recorder for MockConsumer.

func (*MockConsumerMockRecorder) CachedInfo

func (mr *MockConsumerMockRecorder) CachedInfo() *gomock.Call

CachedInfo indicates an expected call of CachedInfo.

func (*MockConsumerMockRecorder) Consume

func (mr *MockConsumerMockRecorder) Consume(handler any, opts ...any) *gomock.Call

Consume indicates an expected call of Consume.

func (*MockConsumerMockRecorder) Fetch

func (mr *MockConsumerMockRecorder) Fetch(batch any, opts ...any) *gomock.Call

Fetch indicates an expected call of Fetch.

func (*MockConsumerMockRecorder) FetchBytes

func (mr *MockConsumerMockRecorder) FetchBytes(maxBytes any, opts ...any) *gomock.Call

FetchBytes indicates an expected call of FetchBytes.

func (*MockConsumerMockRecorder) FetchNoWait

func (mr *MockConsumerMockRecorder) FetchNoWait(batch any) *gomock.Call

FetchNoWait indicates an expected call of FetchNoWait.

func (*MockConsumerMockRecorder) Info

func (mr *MockConsumerMockRecorder) Info(arg0 any) *gomock.Call

Info indicates an expected call of Info.

func (*MockConsumerMockRecorder) Messages

func (mr *MockConsumerMockRecorder) Messages(opts ...any) *gomock.Call

Messages indicates an expected call of Messages.

func (*MockConsumerMockRecorder) Next

func (mr *MockConsumerMockRecorder) Next(opts ...any) *gomock.Call

Next indicates an expected call of Next.

type MockJetStream

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

MockJetStream is a mock of jStream interface.

func NewMockJetStream

func NewMockJetStream(ctrl *gomock.Controller) *MockJetStream

NewMockJetStream creates a new mock instance.

func (*MockJetStream) AccountInfo

func (m *MockJetStream) AccountInfo(ctx context.Context) (*jetstream.AccountInfo, error)

AccountInfo mocks base method.

func (*MockJetStream) CleanupPublisher

func (m *MockJetStream) CleanupPublisher()

CleanupPublisher mocks base method.

func (*MockJetStream) Consumer

func (m *MockJetStream) Consumer(ctx context.Context, stream, consumer string) (jetstream.Consumer, error)

Consumer mocks base method.

func (*MockJetStream) CreateConsumer

func (m *MockJetStream) CreateConsumer(ctx context.Context, stream string, cfg jetstream.ConsumerConfig) (jetstream.Consumer, error)

CreateConsumer mocks base method.

func (*MockJetStream) CreateKeyValue

CreateKeyValue mocks base method.

func (*MockJetStream) CreateObjectStore

CreateObjectStore mocks base method.

func (*MockJetStream) CreateOrUpdateConsumer

func (m *MockJetStream) CreateOrUpdateConsumer(ctx context.Context, stream string, cfg jetstream.ConsumerConfig) (jetstream.Consumer, error)

CreateOrUpdateConsumer mocks base method.

func (*MockJetStream) CreateOrUpdateKeyValue

func (m *MockJetStream) CreateOrUpdateKeyValue(ctx context.Context, cfg jetstream.KeyValueConfig) (jetstream.KeyValue, error)

CreateOrUpdateKeyValue mocks base method.

func (*MockJetStream) CreateOrUpdateObjectStore

func (m *MockJetStream) CreateOrUpdateObjectStore(ctx context.Context, cfg jetstream.ObjectStoreConfig) (jetstream.ObjectStore, error)

CreateOrUpdateObjectStore mocks base method.

func (*MockJetStream) CreateOrUpdateStream

func (m *MockJetStream) CreateOrUpdateStream(ctx context.Context, cfg jetstream.StreamConfig) (jetstream.Stream, error)

CreateOrUpdateStream mocks base method.

func (*MockJetStream) CreateStream

CreateStream mocks base method.

func (*MockJetStream) DeleteConsumer

func (m *MockJetStream) DeleteConsumer(ctx context.Context, stream, consumer string) error

DeleteConsumer mocks base method.

func (*MockJetStream) DeleteKeyValue

func (m *MockJetStream) DeleteKeyValue(ctx context.Context, bucket string) error

DeleteKeyValue mocks base method.

func (*MockJetStream) DeleteObjectStore

func (m *MockJetStream) DeleteObjectStore(ctx context.Context, bucket string) error

DeleteObjectStore mocks base method.

func (*MockJetStream) DeleteStream

func (m *MockJetStream) DeleteStream(ctx context.Context, stream string) error

DeleteStream mocks base method.

func (*MockJetStream) EXPECT

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

func (*MockJetStream) KeyValue

func (m *MockJetStream) KeyValue(ctx context.Context, bucket string) (jetstream.KeyValue, error)

KeyValue mocks base method.

func (*MockJetStream) KeyValueStoreNames

func (m *MockJetStream) KeyValueStoreNames(ctx context.Context) jetstream.KeyValueNamesLister

KeyValueStoreNames mocks base method.

func (*MockJetStream) KeyValueStores

func (m *MockJetStream) KeyValueStores(ctx context.Context) jetstream.KeyValueLister

KeyValueStores mocks base method.

func (*MockJetStream) ListStreams

ListStreams mocks base method.

func (*MockJetStream) ObjectStore

func (m *MockJetStream) ObjectStore(ctx context.Context, bucket string) (jetstream.ObjectStore, error)

ObjectStore mocks base method.

func (*MockJetStream) ObjectStoreNames

ObjectStoreNames mocks base method.

func (*MockJetStream) ObjectStores

ObjectStores mocks base method.

func (*MockJetStream) OrderedConsumer

func (m *MockJetStream) OrderedConsumer(ctx context.Context, stream string, cfg jetstream.OrderedConsumerConfig) (jetstream.Consumer, error)

OrderedConsumer mocks base method.

func (*MockJetStream) Publish

func (m *MockJetStream) Publish(ctx context.Context, subject string, payload []byte, opts ...jetstream.PublishOpt) (*jetstream.PubAck, error)

Publish mocks base method.

func (*MockJetStream) PublishAsync

func (m *MockJetStream) PublishAsync(subject string, payload []byte, opts ...jetstream.PublishOpt) (jetstream.PubAckFuture, error)

PublishAsync mocks base method.

func (*MockJetStream) PublishAsyncComplete

func (m *MockJetStream) PublishAsyncComplete() <-chan struct{}

PublishAsyncComplete mocks base method.

func (*MockJetStream) PublishAsyncPending

func (m *MockJetStream) PublishAsyncPending() int

PublishAsyncPending mocks base method.

func (*MockJetStream) PublishMsg

func (m *MockJetStream) PublishMsg(ctx context.Context, msg *nats.Msg, opts ...jetstream.PublishOpt) (*jetstream.PubAck, error)

PublishMsg mocks base method.

func (*MockJetStream) PublishMsgAsync

func (m *MockJetStream) PublishMsgAsync(msg *nats.Msg, opts ...jetstream.PublishOpt) (jetstream.PubAckFuture, error)

PublishMsgAsync mocks base method.

func (*MockJetStream) Stream

func (m *MockJetStream) Stream(ctx context.Context, stream string) (jetstream.Stream, error)

Stream mocks base method.

func (*MockJetStream) StreamNameBySubject

func (m *MockJetStream) StreamNameBySubject(ctx context.Context, subject string) (string, error)

StreamNameBySubject mocks base method.

func (*MockJetStream) StreamNames

StreamNames mocks base method.

func (*MockJetStream) UpdateConsumer

func (m *MockJetStream) UpdateConsumer(ctx context.Context, stream string, cfg jetstream.ConsumerConfig) (jetstream.Consumer, error)

UpdateConsumer mocks base method.

func (*MockJetStream) UpdateKeyValue

UpdateKeyValue mocks base method.

func (*MockJetStream) UpdateObjectStore

UpdateObjectStore mocks base method.

func (*MockJetStream) UpdateStream

UpdateStream mocks base method.

type MockJetStreamClient

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

MockJetStreamClient is a mock of JetStreamClient interface.

func NewMockJetStreamClient

func NewMockJetStreamClient(ctrl *gomock.Controller) *MockJetStreamClient

NewMockJetStreamClient creates a new mock instance.

func (*MockJetStreamClient) Close

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

Close mocks base method.

func (*MockJetStreamClient) CreateOrUpdateStream

func (m *MockJetStreamClient) CreateOrUpdateStream(ctx context.Context, cfg jetstream.StreamConfig) (jetstream.Stream, error)

CreateOrUpdateStream mocks base method.

func (*MockJetStreamClient) CreateStream

func (m *MockJetStreamClient) CreateStream(ctx context.Context, cfg StreamConfig) error

CreateStream mocks base method.

func (*MockJetStreamClient) DeleteStream

func (m *MockJetStreamClient) DeleteStream(ctx context.Context, name string) error

DeleteStream mocks base method.

func (*MockJetStreamClient) EXPECT

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

func (*MockJetStreamClient) Health

Health mocks base method.

func (*MockJetStreamClient) Publish

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

Publish mocks base method.

func (*MockJetStreamClient) Subscribe

func (m *MockJetStreamClient) Subscribe(ctx context.Context, subject string, handler messageHandler) error

Subscribe mocks base method.

type MockJetStreamClientMockRecorder

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

MockJetStreamClientMockRecorder is the mock recorder for MockJetStreamClient.

func (*MockJetStreamClientMockRecorder) Close

Close indicates an expected call of Close.

func (*MockJetStreamClientMockRecorder) CreateOrUpdateStream

func (mr *MockJetStreamClientMockRecorder) CreateOrUpdateStream(ctx, cfg any) *gomock.Call

CreateOrUpdateStream indicates an expected call of CreateOrUpdateStream.

func (*MockJetStreamClientMockRecorder) CreateStream

func (mr *MockJetStreamClientMockRecorder) CreateStream(ctx, cfg any) *gomock.Call

CreateStream indicates an expected call of CreateStream.

func (*MockJetStreamClientMockRecorder) DeleteStream

func (mr *MockJetStreamClientMockRecorder) DeleteStream(ctx, name any) *gomock.Call

DeleteStream indicates an expected call of DeleteStream.

func (*MockJetStreamClientMockRecorder) Health

Health indicates an expected call of Health.

func (*MockJetStreamClientMockRecorder) Publish

func (mr *MockJetStreamClientMockRecorder) Publish(ctx, subject, message any) *gomock.Call

Publish indicates an expected call of Publish.

func (*MockJetStreamClientMockRecorder) Subscribe

func (mr *MockJetStreamClientMockRecorder) Subscribe(ctx, subject, handler any) *gomock.Call

Subscribe indicates an expected call of Subscribe.

type MockJetStreamCreator

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

MockJetStreamCreator is a mock of JetStreamCreator interface.

func NewMockJetStreamCreator

func NewMockJetStreamCreator(ctrl *gomock.Controller) *MockJetStreamCreator

NewMockJetStreamCreator creates a new mock instance.

func (*MockJetStreamCreator) EXPECT

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

func (*MockJetStreamCreator) New

New mocks base method.

type MockJetStreamCreatorMockRecorder

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

MockJetStreamCreatorMockRecorder is the mock recorder for MockJetStreamCreator.

func (*MockJetStreamCreatorMockRecorder) New

New indicates an expected call of New.

type MockJetStreamMockRecorder

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

MockJetStreamMockRecorder is the mock recorder for MockJetStream.

func (*MockJetStreamMockRecorder) AccountInfo

func (mr *MockJetStreamMockRecorder) AccountInfo(ctx any) *gomock.Call

AccountInfo indicates an expected call of AccountInfo.

func (*MockJetStreamMockRecorder) CleanupPublisher

func (mr *MockJetStreamMockRecorder) CleanupPublisher() *gomock.Call

CleanupPublisher indicates an expected call of CleanupPublisher.

func (*MockJetStreamMockRecorder) Consumer

func (mr *MockJetStreamMockRecorder) Consumer(ctx, stream, consumer any) *gomock.Call

Consumer indicates an expected call of Consumer.

func (*MockJetStreamMockRecorder) CreateConsumer

func (mr *MockJetStreamMockRecorder) CreateConsumer(ctx, stream, cfg any) *gomock.Call

CreateConsumer indicates an expected call of CreateConsumer.

func (*MockJetStreamMockRecorder) CreateKeyValue

func (mr *MockJetStreamMockRecorder) CreateKeyValue(ctx, cfg any) *gomock.Call

CreateKeyValue indicates an expected call of CreateKeyValue.

func (*MockJetStreamMockRecorder) CreateObjectStore

func (mr *MockJetStreamMockRecorder) CreateObjectStore(ctx, cfg any) *gomock.Call

CreateObjectStore indicates an expected call of CreateObjectStore.

func (*MockJetStreamMockRecorder) CreateOrUpdateConsumer

func (mr *MockJetStreamMockRecorder) CreateOrUpdateConsumer(ctx, stream, cfg any) *gomock.Call

CreateOrUpdateConsumer indicates an expected call of CreateOrUpdateConsumer.

func (*MockJetStreamMockRecorder) CreateOrUpdateKeyValue

func (mr *MockJetStreamMockRecorder) CreateOrUpdateKeyValue(ctx, cfg any) *gomock.Call

CreateOrUpdateKeyValue indicates an expected call of CreateOrUpdateKeyValue.

func (*MockJetStreamMockRecorder) CreateOrUpdateObjectStore

func (mr *MockJetStreamMockRecorder) CreateOrUpdateObjectStore(ctx, cfg any) *gomock.Call

CreateOrUpdateObjectStore indicates an expected call of CreateOrUpdateObjectStore.

func (*MockJetStreamMockRecorder) CreateOrUpdateStream

func (mr *MockJetStreamMockRecorder) CreateOrUpdateStream(ctx, cfg any) *gomock.Call

CreateOrUpdateStream indicates an expected call of CreateOrUpdateStream.

func (*MockJetStreamMockRecorder) CreateStream

func (mr *MockJetStreamMockRecorder) CreateStream(ctx, cfg any) *gomock.Call

CreateStream indicates an expected call of CreateStream.

func (*MockJetStreamMockRecorder) DeleteConsumer

func (mr *MockJetStreamMockRecorder) DeleteConsumer(ctx, stream, consumer any) *gomock.Call

DeleteConsumer indicates an expected call of DeleteConsumer.

func (*MockJetStreamMockRecorder) DeleteKeyValue

func (mr *MockJetStreamMockRecorder) DeleteKeyValue(ctx, bucket any) *gomock.Call

DeleteKeyValue indicates an expected call of DeleteKeyValue.

func (*MockJetStreamMockRecorder) DeleteObjectStore

func (mr *MockJetStreamMockRecorder) DeleteObjectStore(ctx, bucket any) *gomock.Call

DeleteObjectStore indicates an expected call of DeleteObjectStore.

func (*MockJetStreamMockRecorder) DeleteStream

func (mr *MockJetStreamMockRecorder) DeleteStream(ctx, stream any) *gomock.Call

DeleteStream indicates an expected call of DeleteStream.

func (*MockJetStreamMockRecorder) KeyValue

func (mr *MockJetStreamMockRecorder) KeyValue(ctx, bucket any) *gomock.Call

KeyValue indicates an expected call of KeyValue.

func (*MockJetStreamMockRecorder) KeyValueStoreNames

func (mr *MockJetStreamMockRecorder) KeyValueStoreNames(ctx any) *gomock.Call

KeyValueStoreNames indicates an expected call of KeyValueStoreNames.

func (*MockJetStreamMockRecorder) KeyValueStores

func (mr *MockJetStreamMockRecorder) KeyValueStores(ctx any) *gomock.Call

KeyValueStores indicates an expected call of KeyValueStores.

func (*MockJetStreamMockRecorder) ListStreams

func (mr *MockJetStreamMockRecorder) ListStreams(arg0 any, arg1 ...any) *gomock.Call

ListStreams indicates an expected call of ListStreams.

func (*MockJetStreamMockRecorder) ObjectStore

func (mr *MockJetStreamMockRecorder) ObjectStore(ctx, bucket any) *gomock.Call

ObjectStore indicates an expected call of ObjectStore.

func (*MockJetStreamMockRecorder) ObjectStoreNames

func (mr *MockJetStreamMockRecorder) ObjectStoreNames(ctx any) *gomock.Call

ObjectStoreNames indicates an expected call of ObjectStoreNames.

func (*MockJetStreamMockRecorder) ObjectStores

func (mr *MockJetStreamMockRecorder) ObjectStores(ctx any) *gomock.Call

ObjectStores indicates an expected call of ObjectStores.

func (*MockJetStreamMockRecorder) OrderedConsumer

func (mr *MockJetStreamMockRecorder) OrderedConsumer(ctx, stream, cfg any) *gomock.Call

OrderedConsumer indicates an expected call of OrderedConsumer.

func (*MockJetStreamMockRecorder) Publish

func (mr *MockJetStreamMockRecorder) Publish(ctx, subject, payload any, opts ...any) *gomock.Call

Publish indicates an expected call of Publish.

func (*MockJetStreamMockRecorder) PublishAsync

func (mr *MockJetStreamMockRecorder) PublishAsync(subject, payload any, opts ...any) *gomock.Call

PublishAsync indicates an expected call of PublishAsync.

func (*MockJetStreamMockRecorder) PublishAsyncComplete

func (mr *MockJetStreamMockRecorder) PublishAsyncComplete() *gomock.Call

PublishAsyncComplete indicates an expected call of PublishAsyncComplete.

func (*MockJetStreamMockRecorder) PublishAsyncPending

func (mr *MockJetStreamMockRecorder) PublishAsyncPending() *gomock.Call

PublishAsyncPending indicates an expected call of PublishAsyncPending.

func (*MockJetStreamMockRecorder) PublishMsg

func (mr *MockJetStreamMockRecorder) PublishMsg(ctx, msg any, opts ...any) *gomock.Call

PublishMsg indicates an expected call of PublishMsg.

func (*MockJetStreamMockRecorder) PublishMsgAsync

func (mr *MockJetStreamMockRecorder) PublishMsgAsync(msg any, opts ...any) *gomock.Call

PublishMsgAsync indicates an expected call of PublishMsgAsync.

func (*MockJetStreamMockRecorder) Stream

func (mr *MockJetStreamMockRecorder) Stream(ctx, stream any) *gomock.Call

Stream indicates an expected call of Stream.

func (*MockJetStreamMockRecorder) StreamNameBySubject

func (mr *MockJetStreamMockRecorder) StreamNameBySubject(ctx, subject any) *gomock.Call

StreamNameBySubject indicates an expected call of StreamNameBySubject.

func (*MockJetStreamMockRecorder) StreamNames

func (mr *MockJetStreamMockRecorder) StreamNames(arg0 any, arg1 ...any) *gomock.Call

StreamNames indicates an expected call of StreamNames.

func (*MockJetStreamMockRecorder) UpdateConsumer

func (mr *MockJetStreamMockRecorder) UpdateConsumer(ctx, stream, cfg any) *gomock.Call

UpdateConsumer indicates an expected call of UpdateConsumer.

func (*MockJetStreamMockRecorder) UpdateKeyValue

func (mr *MockJetStreamMockRecorder) UpdateKeyValue(ctx, cfg any) *gomock.Call

UpdateKeyValue indicates an expected call of UpdateKeyValue.

func (*MockJetStreamMockRecorder) UpdateObjectStore

func (mr *MockJetStreamMockRecorder) UpdateObjectStore(ctx, cfg any) *gomock.Call

UpdateObjectStore indicates an expected call of UpdateObjectStore.

func (*MockJetStreamMockRecorder) UpdateStream

func (mr *MockJetStreamMockRecorder) UpdateStream(ctx, cfg any) *gomock.Call

UpdateStream indicates an expected call of UpdateStream.

type MockMessageBatch

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

MockMessageBatch is a mock of MessageBatch interface.

func NewMockMessageBatch

func NewMockMessageBatch(ctrl *gomock.Controller) *MockMessageBatch

NewMockMessageBatch creates a new mock instance.

func (*MockMessageBatch) EXPECT

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

func (*MockMessageBatch) Error

func (m *MockMessageBatch) Error() error

Error mocks base method.

func (*MockMessageBatch) Messages

func (m *MockMessageBatch) Messages() <-chan jetstream.Msg

Messages mocks base method.

type MockMessageBatchMockRecorder

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

MockMessageBatchMockRecorder is the mock recorder for MockMessageBatch.

func (*MockMessageBatchMockRecorder) Error

Error indicates an expected call of Error.

func (*MockMessageBatchMockRecorder) Messages

func (mr *MockMessageBatchMockRecorder) Messages() *gomock.Call

Messages indicates an expected call of Messages.

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.

type MockMsg

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

MockMsg is a mock of Msg interface.

func NewMockMsg

func NewMockMsg(ctrl *gomock.Controller) *MockMsg

NewMockMsg creates a new mock instance.

func (*MockMsg) Ack

func (m *MockMsg) Ack() error

Ack mocks base method.

func (*MockMsg) Data

func (m *MockMsg) Data() []byte

Data mocks base method.

func (*MockMsg) DoubleAck

func (m *MockMsg) DoubleAck(arg0 context.Context) error

DoubleAck mocks base method.

func (*MockMsg) EXPECT

func (m *MockMsg) EXPECT() *MockMsgMockRecorder

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

func (*MockMsg) Headers

func (m *MockMsg) Headers() nats.Header

Headers mocks base method.

func (*MockMsg) InProgress

func (m *MockMsg) InProgress() error

InProgress mocks base method.

func (*MockMsg) Metadata

func (m *MockMsg) Metadata() (*jetstream.MsgMetadata, error)

Metadata mocks base method.

func (*MockMsg) Nak

func (m *MockMsg) Nak() error

Nak mocks base method.

func (*MockMsg) NakWithDelay

func (m *MockMsg) NakWithDelay(delay time.Duration) error

NakWithDelay mocks base method.

func (*MockMsg) Reply

func (m *MockMsg) Reply() string

Reply mocks base method.

func (*MockMsg) Subject

func (m *MockMsg) Subject() string

Subject mocks base method.

func (*MockMsg) Term

func (m *MockMsg) Term() error

Term mocks base method.

func (*MockMsg) TermWithReason

func (m *MockMsg) TermWithReason(reason string) error

TermWithReason mocks base method.

type MockMsgMockRecorder

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

MockMsgMockRecorder is the mock recorder for MockMsg.

func (*MockMsgMockRecorder) Ack

func (mr *MockMsgMockRecorder) Ack() *gomock.Call

Ack indicates an expected call of Ack.

func (*MockMsgMockRecorder) Data

func (mr *MockMsgMockRecorder) Data() *gomock.Call

Data indicates an expected call of Data.

func (*MockMsgMockRecorder) DoubleAck

func (mr *MockMsgMockRecorder) DoubleAck(arg0 any) *gomock.Call

DoubleAck indicates an expected call of DoubleAck.

func (*MockMsgMockRecorder) Headers

func (mr *MockMsgMockRecorder) Headers() *gomock.Call

Headers indicates an expected call of Headers.

func (*MockMsgMockRecorder) InProgress

func (mr *MockMsgMockRecorder) InProgress() *gomock.Call

InProgress indicates an expected call of InProgress.

func (*MockMsgMockRecorder) Metadata

func (mr *MockMsgMockRecorder) Metadata() *gomock.Call

Metadata indicates an expected call of Metadata.

func (*MockMsgMockRecorder) Nak

func (mr *MockMsgMockRecorder) Nak() *gomock.Call

Nak indicates an expected call of Nak.

func (*MockMsgMockRecorder) NakWithDelay

func (mr *MockMsgMockRecorder) NakWithDelay(delay any) *gomock.Call

NakWithDelay indicates an expected call of NakWithDelay.

func (*MockMsgMockRecorder) Reply

func (mr *MockMsgMockRecorder) Reply() *gomock.Call

Reply indicates an expected call of Reply.

func (*MockMsgMockRecorder) Subject

func (mr *MockMsgMockRecorder) Subject() *gomock.Call

Subject indicates an expected call of Subject.

func (*MockMsgMockRecorder) Term

func (mr *MockMsgMockRecorder) Term() *gomock.Call

Term indicates an expected call of Term.

func (*MockMsgMockRecorder) TermWithReason

func (mr *MockMsgMockRecorder) TermWithReason(reason any) *gomock.Call

TermWithReason indicates an expected call of TermWithReason.

type MockNATSConnector

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

MockNATSConnector is a mock of Connector interface.

func NewMockNATSConnector

func NewMockNATSConnector(ctrl *gomock.Controller) *MockNATSConnector

NewMockNATSConnector creates a new mock instance.

func (*MockNATSConnector) Connect

func (m *MockNATSConnector) Connect(arg0 string, arg1 ...nats.Option) (ConnInterface, error)

Connect mocks base method.

func (*MockNATSConnector) EXPECT

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

type MockNATSConnectorMockRecorder

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

MockNATSConnectorMockRecorder is the mock recorder for MockNATSConnector.

func (*MockNATSConnectorMockRecorder) Connect

func (mr *MockNATSConnectorMockRecorder) Connect(arg0 any, arg1 ...any) *gomock.Call

Connect indicates an expected call of Connect.

type MockStream

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

MockStream is a mock of Stream interface.

func NewMockStream

func NewMockStream(ctrl *gomock.Controller) *MockStream

NewMockStream creates a new mock instance.

func (*MockStream) CachedInfo

func (m *MockStream) CachedInfo() *jetstream.StreamInfo

CachedInfo mocks base method.

func (*MockStream) Consumer

func (m *MockStream) Consumer(ctx context.Context, consumer string) (jetstream.Consumer, error)

Consumer mocks base method.

func (*MockStream) ConsumerNames

func (m *MockStream) ConsumerNames(arg0 context.Context) jetstream.ConsumerNameLister

ConsumerNames mocks base method.

func (*MockStream) CreateConsumer

func (m *MockStream) CreateConsumer(ctx context.Context, cfg jetstream.ConsumerConfig) (jetstream.Consumer, error)

CreateConsumer mocks base method.

func (*MockStream) CreateOrUpdateConsumer

func (m *MockStream) CreateOrUpdateConsumer(ctx context.Context, cfg jetstream.ConsumerConfig) (jetstream.Consumer, error)

CreateOrUpdateConsumer mocks base method.

func (*MockStream) DeleteConsumer

func (m *MockStream) DeleteConsumer(ctx context.Context, consumer string) error

DeleteConsumer mocks base method.

func (*MockStream) DeleteMsg

func (m *MockStream) DeleteMsg(ctx context.Context, seq uint64) error

DeleteMsg mocks base method.

func (*MockStream) EXPECT

func (m *MockStream) EXPECT() *MockStreamMockRecorder

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

func (*MockStream) GetLastMsgForSubject

func (m *MockStream) GetLastMsgForSubject(ctx context.Context, subject string) (*jetstream.RawStreamMsg, error)

GetLastMsgForSubject mocks base method.

func (*MockStream) GetMsg

func (m *MockStream) GetMsg(ctx context.Context, seq uint64, opts ...jetstream.GetMsgOpt) (*jetstream.RawStreamMsg, error)

GetMsg mocks base method.

func (*MockStream) Info

Info mocks base method.

func (*MockStream) ListConsumers

func (m *MockStream) ListConsumers(arg0 context.Context) jetstream.ConsumerInfoLister

ListConsumers mocks base method.

func (*MockStream) OrderedConsumer

OrderedConsumer mocks base method.

func (*MockStream) Purge

func (m *MockStream) Purge(ctx context.Context, opts ...jetstream.StreamPurgeOpt) error

Purge mocks base method.

func (*MockStream) SecureDeleteMsg

func (m *MockStream) SecureDeleteMsg(ctx context.Context, seq uint64) error

SecureDeleteMsg mocks base method.

func (*MockStream) UpdateConsumer

func (m *MockStream) UpdateConsumer(ctx context.Context, cfg jetstream.ConsumerConfig) (jetstream.Consumer, error)

UpdateConsumer mocks base method.

type MockStreamManagerInterface

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

MockStreamManagerInterface is a mock of StreamManagerInterface interface.

func NewMockStreamManagerInterface

func NewMockStreamManagerInterface(ctrl *gomock.Controller) *MockStreamManagerInterface

NewMockStreamManagerInterface creates a new mock instance.

func (*MockStreamManagerInterface) CreateOrUpdateStream

func (m *MockStreamManagerInterface) CreateOrUpdateStream(ctx context.Context, cfg *jetstream.StreamConfig) (jetstream.Stream, error)

CreateOrUpdateStream mocks base method.

func (*MockStreamManagerInterface) CreateStream

func (m *MockStreamManagerInterface) CreateStream(ctx context.Context, cfg StreamConfig) error

CreateStream mocks base method.

func (*MockStreamManagerInterface) DeleteStream

func (m *MockStreamManagerInterface) DeleteStream(ctx context.Context, name string) error

DeleteStream mocks base method.

func (*MockStreamManagerInterface) EXPECT

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

type MockStreamManagerInterfaceMockRecorder

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

MockStreamManagerInterfaceMockRecorder is the mock recorder for MockStreamManagerInterface.

func (*MockStreamManagerInterfaceMockRecorder) CreateOrUpdateStream

func (mr *MockStreamManagerInterfaceMockRecorder) CreateOrUpdateStream(ctx, cfg any) *gomock.Call

CreateOrUpdateStream indicates an expected call of CreateOrUpdateStream.

func (*MockStreamManagerInterfaceMockRecorder) CreateStream

func (mr *MockStreamManagerInterfaceMockRecorder) CreateStream(ctx, cfg any) *gomock.Call

CreateStream indicates an expected call of CreateStream.

func (*MockStreamManagerInterfaceMockRecorder) DeleteStream

func (mr *MockStreamManagerInterfaceMockRecorder) DeleteStream(ctx, name any) *gomock.Call

DeleteStream indicates an expected call of DeleteStream.

type MockStreamMockRecorder

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

MockStreamMockRecorder is the mock recorder for MockStream.

func (*MockStreamMockRecorder) CachedInfo

func (mr *MockStreamMockRecorder) CachedInfo() *gomock.Call

CachedInfo indicates an expected call of CachedInfo.

func (*MockStreamMockRecorder) Consumer

func (mr *MockStreamMockRecorder) Consumer(ctx, consumer any) *gomock.Call

Consumer indicates an expected call of Consumer.

func (*MockStreamMockRecorder) ConsumerNames

func (mr *MockStreamMockRecorder) ConsumerNames(arg0 any) *gomock.Call

ConsumerNames indicates an expected call of ConsumerNames.

func (*MockStreamMockRecorder) CreateConsumer

func (mr *MockStreamMockRecorder) CreateConsumer(ctx, cfg any) *gomock.Call

CreateConsumer indicates an expected call of CreateConsumer.

func (*MockStreamMockRecorder) CreateOrUpdateConsumer

func (mr *MockStreamMockRecorder) CreateOrUpdateConsumer(ctx, cfg any) *gomock.Call

CreateOrUpdateConsumer indicates an expected call of CreateOrUpdateConsumer.

func (*MockStreamMockRecorder) DeleteConsumer

func (mr *MockStreamMockRecorder) DeleteConsumer(ctx, consumer any) *gomock.Call

DeleteConsumer indicates an expected call of DeleteConsumer.

func (*MockStreamMockRecorder) DeleteMsg

func (mr *MockStreamMockRecorder) DeleteMsg(ctx, seq any) *gomock.Call

DeleteMsg indicates an expected call of DeleteMsg.

func (*MockStreamMockRecorder) GetLastMsgForSubject

func (mr *MockStreamMockRecorder) GetLastMsgForSubject(ctx, subject any) *gomock.Call

GetLastMsgForSubject indicates an expected call of GetLastMsgForSubject.

func (*MockStreamMockRecorder) GetMsg

func (mr *MockStreamMockRecorder) GetMsg(ctx, seq any, opts ...any) *gomock.Call

GetMsg indicates an expected call of GetMsg.

func (*MockStreamMockRecorder) Info

func (mr *MockStreamMockRecorder) Info(ctx any, opts ...any) *gomock.Call

Info indicates an expected call of Info.

func (*MockStreamMockRecorder) ListConsumers

func (mr *MockStreamMockRecorder) ListConsumers(arg0 any) *gomock.Call

ListConsumers indicates an expected call of ListConsumers.

func (*MockStreamMockRecorder) OrderedConsumer

func (mr *MockStreamMockRecorder) OrderedConsumer(ctx, cfg any) *gomock.Call

OrderedConsumer indicates an expected call of OrderedConsumer.

func (*MockStreamMockRecorder) Purge

func (mr *MockStreamMockRecorder) Purge(ctx any, opts ...any) *gomock.Call

Purge indicates an expected call of Purge.

func (*MockStreamMockRecorder) SecureDeleteMsg

func (mr *MockStreamMockRecorder) SecureDeleteMsg(ctx, seq any) *gomock.Call

SecureDeleteMsg indicates an expected call of SecureDeleteMsg.

func (*MockStreamMockRecorder) UpdateConsumer

func (mr *MockStreamMockRecorder) UpdateConsumer(ctx, cfg any) *gomock.Call

UpdateConsumer indicates an expected call of UpdateConsumer.

type MockSubscriptionManagerInterface

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

MockSubscriptionManagerInterface is a mock of SubscriptionManagerInterface interface.

func NewMockSubscriptionManagerInterface

func NewMockSubscriptionManagerInterface(ctrl *gomock.Controller) *MockSubscriptionManagerInterface

NewMockSubscriptionManagerInterface creates a new mock instance.

func (*MockSubscriptionManagerInterface) Close

Close mocks base method.

func (*MockSubscriptionManagerInterface) EXPECT

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

func (*MockSubscriptionManagerInterface) Subscribe

func (m *MockSubscriptionManagerInterface) Subscribe(ctx context.Context, topic string, js jetstream.JetStream, cfg *Config, logger pubsub.Logger, metrics Metrics) (*pubsub.Message, error)

Subscribe mocks base method.

type MockSubscriptionManagerInterfaceMockRecorder

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

MockSubscriptionManagerInterfaceMockRecorder is the mock recorder for MockSubscriptionManagerInterface.

func (*MockSubscriptionManagerInterfaceMockRecorder) Close

Close indicates an expected call of Close.

func (*MockSubscriptionManagerInterfaceMockRecorder) Subscribe

func (mr *MockSubscriptionManagerInterfaceMockRecorder) Subscribe(ctx, topic, js, cfg, logger, metrics any) *gomock.Call

Subscribe indicates an expected call of Subscribe.

type MockTracer

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

MockTracer is a mock of Tracer interface.

func NewMockTracer

func NewMockTracer(ctrl *gomock.Controller) *MockTracer

NewMockTracer creates a new mock instance.

func (*MockTracer) EXPECT

func (m *MockTracer) EXPECT() *MockTracerMockRecorder

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

func (*MockTracer) Start

func (m *MockTracer) Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

Start mocks base method.

type MockTracerMockRecorder

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

MockTracerMockRecorder is the mock recorder for MockTracer.

func (*MockTracerMockRecorder) Start

func (mr *MockTracerMockRecorder) Start(ctx, spanName any, opts ...any) *gomock.Call

Start indicates an expected call of Start.

type PubSubWrapper

type PubSubWrapper struct {
	Client *Client
}

PubSubWrapper adapts Client to pubsub.JetStreamClient.

func New

func New(cfg *Config, logger pubsub.Logger) *PubSubWrapper

New creates a new Client.

func (*PubSubWrapper) Close

func (w *PubSubWrapper) Close() error

Close closes the Client.

func (*PubSubWrapper) Connect

func (w *PubSubWrapper) Connect()

Connect establishes a connection to NATS.

func (*PubSubWrapper) CreateTopic

func (w *PubSubWrapper) CreateTopic(ctx context.Context, name string) error

CreateTopic creates a new topic (stream) in NATS jStream.

func (*PubSubWrapper) DeleteTopic

func (w *PubSubWrapper) DeleteTopic(ctx context.Context, name string) error

DeleteTopic deletes a topic (stream) in NATS jStream.

func (*PubSubWrapper) Health

func (w *PubSubWrapper) Health() datasource.Health

Health returns the health status of the Client.

func (*PubSubWrapper) Publish

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

Publish publishes a message to a topic.

func (*PubSubWrapper) Subscribe

func (w *PubSubWrapper) Subscribe(ctx context.Context, topic string) (*pubsub.Message, error)

Subscribe subscribes to a topic and returns a single message.

func (*PubSubWrapper) UseLogger

func (w *PubSubWrapper) UseLogger(logger any)

UseLogger sets the logger for the NATS client.

func (*PubSubWrapper) UseMetrics

func (w *PubSubWrapper) UseMetrics(metrics any)

UseMetrics sets the metrics for the NATS client.

func (*PubSubWrapper) UseTracer

func (w *PubSubWrapper) UseTracer(tracer any)

UseTracer sets the tracer for the NATS client.

type StreamConfig

type StreamConfig struct {
	Stream     string
	Subjects   []string
	MaxDeliver int
	MaxWait    time.Duration
	MaxBytes   int64
}

StreamConfig holds stream settings for NATS jStream.

type StreamManager

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

StreamManager is a manager for jStream streams.

func (*StreamManager) CreateOrUpdateStream

func (sm *StreamManager) CreateOrUpdateStream(ctx context.Context, cfg *jetstream.StreamConfig) (jetstream.Stream, error)

CreateOrUpdateStream creates or updates a jStream stream.

func (*StreamManager) CreateStream

func (sm *StreamManager) CreateStream(ctx context.Context, cfg StreamConfig) error

CreateStream creates a new jStream stream.

func (*StreamManager) DeleteStream

func (sm *StreamManager) DeleteStream(ctx context.Context, name string) error

DeleteStream deletes a jStream stream.

func (*StreamManager) GetStream

func (sm *StreamManager) GetStream(ctx context.Context, name string) (jetstream.Stream, error)

GetStream gets a jStream stream.

type StreamManagerInterface

type StreamManagerInterface interface {
	CreateStream(ctx context.Context, cfg StreamConfig) error
	DeleteStream(ctx context.Context, name string) error
	CreateOrUpdateStream(ctx context.Context, cfg *jetstream.StreamConfig) (jetstream.Stream, error)
}

StreamManagerInterface represents the main Stream Manager.

type SubscriptionManager

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

func (*SubscriptionManager) Close

func (sm *SubscriptionManager) Close()

func (*SubscriptionManager) Subscribe

func (sm *SubscriptionManager) Subscribe(
	ctx context.Context,
	topic string,
	js jetstream.JetStream,
	cfg *Config,
	logger pubsub.Logger,
	metrics Metrics) (*pubsub.Message, error)

type SubscriptionManagerInterface

type SubscriptionManagerInterface interface {
	Subscribe(
		ctx context.Context,
		topic string,
		js jetstream.JetStream,
		cfg *Config,
		logger pubsub.Logger,
		metrics Metrics) (*pubsub.Message, error)
	Close()
}

SubscriptionManagerInterface represents the main Subscription Manager.

Jump to

Keyboard shortcuts

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