models

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelPoolConfig

type ChannelPoolConfig struct {
	ErrorBuffer          uint16 `json:"ErrorBuffer"`
	SleepOnErrorInterval uint32 `json:"SleepOnErrorInterval"` // sleep length on errors
	MaxChannelCount      uint64 `json:"MaxChannelCount"`
	MaxAckChannelCount   uint64 `json:"MaxAckChannelCount"`
	AckNoWait            bool   `json:"AckNoWait"`
	GlobalQosCount       int    `json:"GlobalQosCount"` // Leave at 0 if you want to ignore them.
}

ChannelPoolConfig represents settings for creating channel pools.

type CompressionConfig

type CompressionConfig struct {
	Enabled bool   `json:"Enabled"`
	Type    string `json:"Type,omitempty"`
}

CompressionConfig allows you to configuration symmetric key encryption based on options

type ConnectionPoolConfig

type ConnectionPoolConfig struct {
	ConnectionName       string     `json:"ConnectionName"`
	URI                  string     `json:"URI"`
	Heartbeat            uint32     `json:"Heartbeat"`
	ConnectionTimeout    uint32     `json:"ConnectionTimeout"`
	ErrorBuffer          uint16     `json:"ErrorBuffer"`
	SleepOnErrorInterval uint32     `json:"SleepOnErrorInterval"` // sleep length on errors
	EnableTLS            bool       `json:"EnableTLS"`            // Use TLSConfig to create connections with AMQPS uri.
	MaxConnectionCount   uint64     `json:"MaxConnectionCount"`   // number of connections to create in the pool
	TLSConfig            *TLSConfig `json:"TLSConfig"`            // TLS settings for connection with AMQPS.
}

ConnectionPoolConfig represents settings for creating connection pools.

type ConsumerConfig

type ConsumerConfig struct {
	Enabled              bool                   `json:"Enabled"`
	QueueName            string                 `json:"QueueName"`
	ConsumerName         string                 `json:"ConsumerName"`
	AutoAck              bool                   `json:"AutoAck"`
	Exclusive            bool                   `json:"Exclusive"`
	NoWait               bool                   `json:"NoWait"`
	Args                 map[string]interface{} `json:"Args"`
	QosCountOverride     int                    `json:"QosCountOverride"` // if zero ignored
	MessageBuffer        uint32                 `json:"MessageBuffer"`
	ErrorBuffer          uint32                 `json:"ErrorBuffer"`
	SleepOnErrorInterval uint32                 `json:"SleepOnErrorInterval"` // sleep on error
	SleepOnIdleInterval  uint32                 `json:"SleepOnIdleInterval"`  // sleep on idle
}

ConsumerConfig represents settings for configuring a consumer with ease.

type EncryptionConfig

type EncryptionConfig struct {
	Enabled           bool   `json:"Enabled"`
	Type              string `json:"Type,omitempty"`
	Hashkey           []byte
	TimeConsideration uint32 `json:"TimeConsideration,omitempty"`
	MemoryMultiplier  uint32 `json:""`
	Threads           uint8  `json:"Threads,omitempty"`
}

EncryptionConfig allows you to configuration symmetric key encryption based on options

type Envelope

type Envelope struct {
	Exchange     string
	RoutingKey   string
	ContentType  string
	Mandatory    bool
	Immediate    bool
	Headers      map[string]interface{}
	DeliveryMode uint8
}

Envelope contains all the address details of where a letter is going.

type ErrorMessage

type ErrorMessage struct {
	Code    int
	Reason  string
	Server  bool
	Recover bool
}

ErrorMessage allow for you to replay a message that was returned.

func NewErrorMessage

func NewErrorMessage(amqpError *amqp.Error) *ErrorMessage

NewErrorMessage creates a new ErrorMessage.

func (*ErrorMessage) Error

func (em *ErrorMessage) Error() string

Error allows you to quickly log the ErrorMessage struct as a string.

type Exchange

type Exchange struct {
	Name           string     `json:"Name"`
	Type           string     `json:"Type"` // "direct", "fanout", "topic", "headers"
	PassiveDeclare bool       `json:"PassiveDeclare"`
	Durable        bool       `json:"Durable"`
	AutoDelete     bool       `json:"AutoDelete"`
	InternalOnly   bool       `json:"InternalOnly"`
	NoWait         bool       `json:"NoWait"`
	Args           amqp.Table `json:"Args,omitempty"` // map[string]interface()
}

Exchange allows for you to create Exchange topology.

type ExchangeBinding

type ExchangeBinding struct {
	ExchangeName       string     `json:"ExchangeName"`
	ParentExchangeName string     `json:"ParentExchangeName"`
	RoutingKey         string     `json:"RoutingKey"`
	NoWait             bool       `json:"NoWait"`
	Args               amqp.Table `json:"Args,omitempty"` // map[string]interface()
}

ExchangeBinding allows for you to create Bindings between an Exchange and Exchange.

type Letter

type Letter struct {
	LetterID   uint64
	RetryCount uint32
	Body       []byte
	Envelope   *Envelope
}

Letter contains the message body and address of where things are going.

type Message

type Message struct {
	IsAckable bool
	Body      []byte
	// contains filtered or unexported fields
}

Message allow for you to acknowledge, after processing the payload, by its RabbitMQ tag and Channel pointer.

func NewMessage

func NewMessage(
	isAckable bool,
	body []byte,
	deliveryTag uint64,
	messageID string,
	amqpChan *amqp.Channel) *Message

NewMessage creates a new Message.

func (*Message) Acknowledge

func (msg *Message) Acknowledge() error

Acknowledge allows for you to acknowledge message on the original channel it was received. Will fail if channel is closed and this is by design per RabbitMQ server. Can't ack from a different channel.

func (*Message) Nack

func (msg *Message) Nack(requeue bool) error

Nack allows for you to negative acknowledge message on the original channel it was received. Will fail if channel is closed and this is by design per RabbitMQ server.

func (*Message) Reject

func (msg *Message) Reject(requeue bool) error

Reject allows for you to reject on the original channel it was received. Will fail if channel is closed and this is by design per RabbitMQ server.

type ModdedBody

type ModdedBody struct {
	Encrypted   bool   `json:"Encrypted"`
	EType       string `json:"EncryptionType,omitempty"`
	Compressed  bool   `json:"Compressed"`
	CType       string `json:"CompressionType,omitempty"`
	UTCDateTime string `json:"UTCDateTime"`
	Data        []byte `json:"Data"`
}

ModdedBody is a payload with modifications and indicators of what was modified.

type ModdedLetter

type ModdedLetter struct {
	LetterID       uint64      `json:"LetterID"`
	Body           *ModdedBody `json:"Body"`
	LetterMetadata string      `json:"LetterMetadata"`
}

ModdedLetter is a letter with a modified body and indicators of what was done to it.

type Notification

type Notification struct {
	LetterID     uint64
	FailedLetter *Letter
	Success      bool
	Error        error
}

Notification is a way to communicate between callers

func (*Notification) ToString

func (not *Notification) ToString() string

ToString allows you to quickly log the Notification struct as a string.

type PoolConfig

type PoolConfig struct {
	ChannelPoolConfig    *ChannelPoolConfig    `json:"ChannelPoolConfig"`
	ConnectionPoolConfig *ConnectionPoolConfig `json:"ConnectionPoolConfig"`
}

PoolConfig represents settings for creating/configuring pools.

type PublisherConfig

type PublisherConfig struct {
	SleepOnIdleInterval      uint32 `json:"SleepOnIdleInterval"`
	SleepOnQueueFullInterval uint32 `json:"SleepOnQueueFullInterval"`
	SleepOnErrorInterval     uint32 `json:"SleepOnErrorInterval"`
	LetterBuffer             uint64 `json:"LetterBuffer"`
	MaxOverBuffer            uint64 `json:"MaxOverBuffer"`
	NotificationBuffer       uint32 `json:"NotificationBuffer"`
}

PublisherConfig represents settings for configuring global settings for all Publishers with ease.

type Queue

type Queue struct {
	Name           string     `json:"Name"`
	PassiveDeclare bool       `json:"PassiveDeclare"`
	Durable        bool       `json:"Durable"`
	AutoDelete     bool       `json:"AutoDelete"`
	Exclusive      bool       `json:"Exclusive"`
	NoWait         bool       `json:"NoWait"`
	Args           amqp.Table `json:"Args,omitempty"` // map[string]interface()
}

Queue allows for you to create Queue topology.

type QueueBinding

type QueueBinding struct {
	QueueName    string     `json:"QueueName"`
	ExchangeName string     `json:"ExchangeName"`
	RoutingKey   string     `json:"RoutingKey"`
	NoWait       bool       `json:"NoWait"`
	Args         amqp.Table `json:"Args,omitempty"` // map[string]interface()
}

QueueBinding allows for you to create Bindings between a Queue and Exchange.

type RabbitSeasoning

type RabbitSeasoning struct {
	ServiceConfig     *ServiceConfig             `json:"ServiceConfig"`
	EncryptionConfig  *EncryptionConfig          `json:"EncryptionConfig"`
	CompressionConfig *CompressionConfig         `json:"CompressionConfig"`
	PoolConfig        *PoolConfig                `json:"PoolConfig"`
	ConsumerConfigs   map[string]*ConsumerConfig `json:"ConsumerConfigs"`
	PublisherConfig   *PublisherConfig           `json:"PublisherConfig"`
}

RabbitSeasoning represents the configuration values.

type ReturnMessage

type ReturnMessage struct {
	ReplyCode  uint16 // reason
	ReplyText  string // description
	Exchange   string // basic.publish exchange
	RoutingKey string // basic.publish routing key

	// Properties
	ContentType     string                 // MIME content type
	ContentEncoding string                 // MIME content encoding
	Headers         map[string]interface{} // Application or header exchange table
	DeliveryMode    uint8                  // queue implementation use - non-persistent (1) or persistent (2)
	Priority        uint8                  // queue implementation use - 0 to 9
	CorrelationID   string                 // application use - correlation identifier
	ReplyTo         string                 // application use - address to to reply to (ex: RPC)
	Expiration      string                 // implementation use - message expiration spec
	MessageID       string                 // application use - message identifier
	Timestamp       time.Time              // application use - message timestamp
	Type            string                 // application use - message type name
	UserID          string                 // application use - creating user id
	AppID           string                 // application use - creating application

	Body []byte
}

ReturnMessage allow for you to replay a message that was returned.

func NewReturnMessage

func NewReturnMessage(amqpReturn *amqp.Return) *ReturnMessage

NewReturnMessage creates a new ReturnMessage.

type ServiceConfig

type ServiceConfig struct {
	ErrorBuffer uint16 `json:"ErrorBuffer"`
}

ServiceConfig represents settings for creating RabbitServices.

type TLSConfig

type TLSConfig struct {
	PEMCertLocation   string `json:"PEMCertLocation"`
	LocalCertLocation string `json:"LocalCertLocation"`
	CertServerName    string `json:"CertServerName"`
}

TLSConfig represents settings for configuring TLS.

type TcrError

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

TcrError is a custom TurboCookedRabbit error.

func (*TcrError) Error

func (te *TcrError) Error() string

type TopologyConfig

type TopologyConfig struct {
	Exchanges        []*Exchange        `json:"Exchanges"`
	Queues           []*Queue           `json:"Queues"`
	QueueBindings    []*QueueBinding    `json:"QueueBindings"`
	ExchangeBindings []*ExchangeBinding `json:"ExchangeBindings"`
}

TopologyConfig allows you to build simple toplogies from a JSON file.

Jump to

Keyboard shortcuts

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