amqp

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SourceID        string            `json:"source_id" yaml:"source_id"`
	URL             string            `json:"url" yaml:"url"`
	Queue           string            `json:"queue" yaml:"queue"`
	Exchange        string            `json:"exchange" yaml:"exchange"`
	RoutingKey      string            `json:"routing_key" yaml:"routing_key"`
	ConsumerTag     string            `json:"consumer_tag" yaml:"consumer_tag"`
	AutoAck         bool              `json:"auto_ack" yaml:"auto_ack"`
	Prefetch        int               `json:"prefetch" yaml:"prefetch"`
	Format          string            `json:"format" yaml:"format"` // json or raw
	SchemaName      string            `json:"schema_name" yaml:"schema_name"`
	SchemaVersion   string            `json:"schema_version" yaml:"schema_version"`
	SchemaHeader    string            `json:"schema_header" yaml:"schema_header"`
	QueueDeclare    bool              `json:"queue_declare" yaml:"queue_declare"`
	QueueDurable    bool              `json:"queue_durable" yaml:"queue_durable"`
	QueueExclusive  bool              `json:"queue_exclusive" yaml:"queue_exclusive"`
	QueueAutoDel    bool              `json:"queue_auto_delete" yaml:"queue_auto_delete"`
	ExchangeType    string            `json:"exchange_type" yaml:"exchange_type"`
	ExchangeDeclare bool              `json:"exchange_declare" yaml:"exchange_declare"`
	Headers         map[string]string `json:"headers" yaml:"headers"`
	BufferSize      int               `json:"buffer_size" yaml:"buffer_size"`
}

Config holds AMQP adapter configuration.

type Factory

type Factory struct{}

Factory creates AMQP sources from generic config.

func (*Factory) Create

func (f *Factory) Create(config adapters.SourceConfig) (adapters.FactSource, error)

func (*Factory) GetConfigSchema

func (f *Factory) GetConfigSchema() adapters.ConfigSchema

func (*Factory) ValidateConfig

func (f *Factory) ValidateConfig(config adapters.SourceConfig) error

type Source

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

Source implements AMQP consumption as a fact source.

func NewSource

func NewSource(config *Config, mappings []adapters.FactMapping) (*Source, error)

NewSource creates a new AMQP source.

func (*Source) GetMetadata

func (s *Source) GetMetadata() adapters.SourceMetadata

GetMetadata returns source metadata.

func (*Source) GetSourceSchema

func (s *Source) GetSourceSchema() *adapters.Schema

GetSourceSchema returns schema metadata.

func (*Source) HealthCheck

func (s *Source) HealthCheck() error

HealthCheck checks connection status.

func (*Source) Start

func (s *Source) Start(ctx context.Context) error

Start connects and begins consumption.

func (*Source) Stop

func (s *Source) Stop(ctx context.Context) error

Stop stops consumption and closes connection.

func (*Source) Subscribe

func (s *Source) Subscribe(ctx context.Context, factTypes []string) (<-chan *adapters.TypedFact, error)

Subscribe starts consuming messages.

Jump to

Keyboard shortcuts

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