transport

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AWSDefaultConfigLoader  = awsconfig.LoadDefaultConfig
	SNSTopicResolverFactory = sns.NewGenerateArnTopicResolver
	SNSPublisherFactory     = func(cfg sns.PublisherConfig, logger watermill.LoggerAdapter) (message.Publisher, error) {
		return sns.NewPublisher(cfg, logger)
	}
	SNSSubscriberFactory = func(cfg sns.SubscriberConfig, sqsCfg sqs.SubscriberConfig, logger watermill.LoggerAdapter) (message.Subscriber, error) {
		return sns.NewSubscriber(cfg, sqsCfg, logger)
	}
)
View Source
var (
	KafkaPublisherFactory = func(cfg kafka.PublisherConfig, logger watermill.LoggerAdapter) (message.Publisher, error) {
		return kafka.NewPublisher(cfg, logger)
	}
	KafkaSubscriberFactory = func(cfg kafka.SubscriberConfig, logger watermill.LoggerAdapter) (message.Subscriber, error) {
		return kafka.NewSubscriber(cfg, logger)
	}
)
View Source
var (
	AmqpConnectionFactory = func(cfg amqp.ConnectionConfig, logger watermill.LoggerAdapter) (*amqp.ConnectionWrapper, error) {
		return amqp.NewConnection(cfg, logger)
	}
	AmqpPublisherFactory = func(cfg amqp.Config, logger watermill.LoggerAdapter, conn *amqp.ConnectionWrapper) (message.Publisher, error) {
		return amqp.NewPublisherWithConnection(cfg, logger, conn)
	}
	AmqpSubscriberFactory = func(cfg amqp.Config, logger watermill.LoggerAdapter, conn *amqp.ConnectionWrapper) (message.Subscriber, error) {
		return amqp.NewSubscriberWithConnection(cfg, logger, conn)
	}
)

Functions

This section is empty.

Types

type Factory

type Factory interface {
	Build(ctx context.Context, conf *config.Config, logger watermill.LoggerAdapter) (Transport, error)
}

Factory abstracts how Protoflow initialises message transports.

func DefaultFactory

func DefaultFactory() Factory

DefaultFactory returns the built-in transport factory that knows how to initialise Kafka, RabbitMQ, and AWS SNS/SQS transports.

type Transport

type Transport struct {
	Publisher  message.Publisher
	Subscriber message.Subscriber
}

Transport combines a publisher and subscriber pair produced by a factory.

Jump to

Keyboard shortcuts

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