messaging

package
v0.10.10 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MESSAGING_TIMEOUT = 30
)

Variables

This section is empty.

Functions

func NewRabbitPublisher added in v0.10.9

func NewRabbitPublisher(file string, pool *database.Pool) *migration.MessageService

NewRabbitPublisher is a function that creates a new RabbitMQ publisher and publishes all messages from the database. It is used to publish messages that were not published due to a RabbitMQ connection failure. The messages are published in the same order they were created. The table used to store the messages is: create table if not exists RabbitCache(RabbitCacheID string primary key, DE_Exchange string, DE_RoutingKey string, JS_Data text, SN_Durable integer, TS_Operacao string) The table is created in memory and is not persisted. To send a message, you have to call the function Send of the message service that uses the same database connection. the function needs the following parameters: - exchange: the exchange name - routingKey: the routing key - data: the message data - durable: if the message is durable

Types

type Channels

type Channels struct {
	// Channel for sending messages to the messaging adapter
	// Each message must have the following structure:
	// {
	// 	"EM_Destinatario": "email address",
	// 	"DE_Body": "message body",
	//  "DE_Assunto": "message subject
	// }
	Email chan map[string]interface{}
	// Channel for sending messages to the messaging adapter
	// Each message must have the following structure:
	// {
	// 	"DE_Telefone": "phone number",
	// 	"DE_Mensagem": "message body",
	// }
	SMS chan map[string]string
	// Channel for sending messages to the messaging adapter
	// Each message must have the following structure:
	// {
	// 	"DE_Telefone": "phone number",
	// 	"DE_Mensagem": "message body",
	// }
	Whatsapp chan map[string]interface{}
	// Channel for sending messages to the messaging adapter
	// Each message must have the following structure:
	// {
	// 	"exchange": "exchange name",
	// 	"routingKey": "routing key",
	// 	"body": "message body",
	// 	"durable": "if the message is durable",
	// }
	Messaging chan map[string]interface{}
}

func NewChannels

func NewChannels() *Channels

type Mailer

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

func NewMailer

func NewMailer() *Mailer

func (*Mailer) GetBody

func (m *Mailer) GetBody() string

func (*Mailer) GetMimeHeaders

func (m *Mailer) GetMimeHeaders() string

func (*Mailer) GetSubject

func (m *Mailer) GetSubject() string

func (*Mailer) GetTo

func (m *Mailer) GetTo() string

func (*Mailer) Send

func (m *Mailer) Send() error

func (*Mailer) SetBody

func (m *Mailer) SetBody(body string)

func (*Mailer) SetConfig

func (m *Mailer) SetConfig(config map[string]string)

func (*Mailer) SetMimeHeaders

func (m *Mailer) SetMimeHeaders(mimeHeaders string)

func (*Mailer) SetSubject

func (m *Mailer) SetSubject(subject string)

func (*Mailer) SetTo

func (m *Mailer) SetTo(to string)

type Rabbit added in v0.10.0

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

func NewRabbit added in v0.10.0

func NewRabbit(file string) *Rabbit

func (*Rabbit) Consume added in v0.10.0

func (r *Rabbit) Consume(queue string, callback func(amqp.Delivery)) error

func (*Rabbit) DeclareExchange added in v0.10.0

func (r *Rabbit) DeclareExchange(exchange string) error

func (*Rabbit) DeclareQueue added in v0.10.0

func (r *Rabbit) DeclareQueue(queue, exchange, routingKey string) error

func (*Rabbit) Disconnect added in v0.10.0

func (r *Rabbit) Disconnect() error

func (*Rabbit) IsConnected added in v0.10.0

func (r *Rabbit) IsConnected() bool

func (*Rabbit) Publish added in v0.10.0

func (r *Rabbit) Publish(exchange, routingKey string, body []byte) error

func (*Rabbit) PublishFromCache added in v0.10.0

func (r *Rabbit) PublishFromCache(messageService *migration.MessageService) error

type RabbitConfig added in v0.10.0

type RabbitConfig struct {
	DSN string `json:"dsn"`
	// contains filtered or unexported fields
}

func (*RabbitConfig) LoadRabbitConfig added in v0.10.0

func (r *RabbitConfig) LoadRabbitConfig(file string) error

Jump to

Keyboard shortcuts

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