Documentation
¶
Overview ¶
Package jetstream provides a NATS JetStream transport for protoflow.
Index ¶
Constants ¶
View Source
const ( // DefaultMaxDeliver is the default max delivery attempts. DefaultMaxDeliver = 3 // DefaultAckWait is the default ack wait timeout. DefaultAckWait = 30 * time.Second // MetadataDelay is the metadata key for delay. MetadataDelay = "pf_delay_ms" )
View Source
const TransportName = "nats-jetstream"
TransportName is the name used to register this transport.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(ctx context.Context, cfg transport.Config, logger watermill.LoggerAdapter) (transport.Transport, error)
Build creates a new NATS JetStream transport.
func Capabilities ¶
func Capabilities() transport.Capabilities
Capabilities returns the capabilities of this transport.
Types ¶
type Config ¶
type Config struct {
// URL is the NATS server URL.
URL string
// StreamName is the name of the JetStream stream to use.
// If empty, defaults to "PROTOFLOW".
StreamName string
// MaxDeliver is the maximum number of delivery attempts.
MaxDeliver int
// AckWait is the duration to wait for acknowledgment.
AckWait time.Duration
// Replicas is the number of stream replicas (for clustering).
Replicas int
// RetentionPolicy: "limits" (default), "interest", or "workqueue"
RetentionPolicy string
}
Config holds NATS JetStream-specific configuration.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport implements Publisher and Subscriber for NATS JetStream.
func New ¶
func New(cfg Config, logger watermill.LoggerAdapter) (*Transport, error)
New creates a new NATS JetStream transport.
func (*Transport) GetCapabilities ¶
func (t *Transport) GetCapabilities() transport.Capabilities
GetCapabilities returns the JetStream transport capabilities.
Click to show internal directories.
Click to hide internal directories.