Documentation
¶
Index ¶
- Constants
- Variables
- func Ack(queueName string, payload []byte) error
- func ActiveAddr() string
- func Allow(key string, limit int, window time.Duration) (bool, int, error)
- func AllowPublic(key string) (bool, int, error)
- func ClearQueue(queueName string) (int64, error)
- func Client() *goredis.Client
- func Close()
- func Configure(o Options)
- func CurrentPrefix() string
- func DeleteDeadLetter(itemToFind string) (int64, error)
- func Dequeue(queueName string, timeout time.Duration) ([]byte, bool, error)
- func DequeueReliable(queueName string, timeout time.Duration) ([]byte, bool, error)
- func Diagnostics() string
- func Enqueue(queueName string, task interface{}) error
- func EnqueueWebhook(provider, eventType string, event map[string]interface{}, payload string) error
- func EnsureInitialized(component string) error
- func Init(addrOverride string)
- func IsReady() bool
- func Key(name string) string
- func LogErr(what string, cmd interface{ ... })
- func ProcessOneFromQueue(queueName string, senderFunc func(string, string, string, interface{}) error) (bool, error)
- func ProcessingName(queueName string) string
- func PushDeadLetter(queueName string, payload []byte) error
- func Reconnect(reason error) error
- func RecordEmailError(task EmailTask, attempt int, sendErr error)
- func RecordEmailSent(task EmailTask, attempts int)
- func RecoverProcessing(queueName string) (int, error)
- func RequeueDeadLetter() (bool, error)
- func StartEmailWorker(send func(EmailTask) error, permanent func(error) bool)
- type EmailAttachment
- type EmailDeliveryState
- type EmailErrorRecord
- type EmailSentRecord
- type EmailTask
- type EmailWorkerConfig
- type Options
- type RateLimitConfig
- type Settings
- type TelegramTask
- type WebhookJob
Constants ¶
View Source
const ( EmailQueueName = "email_queue" EmailQueueDeadName = "email_queue_dead" EmailQueueRetryName = "email_queue_retry" EmailSentLogName = "email_sent_log" EmailErrorLogName = "email_error_log" WebhookQueueName = "webhook_queue" WebhookDeadName = "webhook_queue_dead" TelegramQueueName = "telegram_queue" TelegramDeadName = "telegram_queue_dead" )
Variables ¶
View Source
var ( RDB *goredis.Client Ctx = context.Background() Prefix string )
View Source
var EmailWorkerConfigFn func() EmailWorkerConfig
View Source
var RateLimitConfigFn func() RateLimitConfig
Functions ¶
func ActiveAddr ¶
func ActiveAddr() string
func ClearQueue ¶
func CurrentPrefix ¶
func CurrentPrefix() string
func DeleteDeadLetter ¶
func DequeueReliable ¶
func Diagnostics ¶
func Diagnostics() string
func EnqueueWebhook ¶
func EnsureInitialized ¶
func ProcessOneFromQueue ¶
func ProcessingName ¶
func PushDeadLetter ¶
func RecordEmailError ¶
func RecordEmailSent ¶
func RecoverProcessing ¶
func RequeueDeadLetter ¶
Types ¶
type EmailAttachment ¶
type EmailAttachment struct {
Filename string `json:"filename"`
ContentType string `json:"content_type"`
Data []byte `json:"data,omitempty"`
ContentBase64 string `json:"content_base64,omitempty"`
}
func NewEmailAttachment ¶
func NewEmailAttachment(filename, contentType string, content []byte) EmailAttachment
func (EmailAttachment) Bytes ¶
func (a EmailAttachment) Bytes() ([]byte, error)
type EmailDeliveryState ¶
func EmailDeliveryStatus ¶
func EmailDeliveryStatus(toEmail, templateName string, since time.Time) EmailDeliveryState
type EmailErrorRecord ¶
type EmailSentRecord ¶
type EmailTask ¶
type EmailTask struct {
ToEmail string
Subject string
TemplateName string
Data interface{}
Attachments []EmailAttachment `json:"attachments,omitempty"`
OrderID string `json:"order_id,omitempty"`
QueuedAt string `json:"queued_at,omitempty"`
Attempts int `json:"attempts,omitempty"`
RawJSON string `json:"-"`
}
func InspectQueue ¶
func (EmailTask) MailerAttachments ¶
func (t EmailTask) MailerAttachments() ([]mailer.Attachment, error)
type EmailWorkerConfig ¶
type RateLimitConfig ¶
type TelegramTask ¶
type WebhookJob ¶
type WebhookJob struct {
ID string `json:"id"`
Provider string `json:"provider"`
EventType string `json:"event_type"`
Event map[string]interface{} `json:"event"`
Payload string `json:"payload"`
EnqueuedAt time.Time `json:"enqueued_at"`
Attempts int `json:"attempts"`
MaxRetries int `json:"max_retries"`
}
Click to show internal directories.
Click to hide internal directories.