queues

package
v0.0.0-...-074fcce Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForEmpty

func CheckForEmpty(qMessage QMessage) error

func ErrorHandler

func ErrorHandler(err error) (b bool)

TODO: REMOVE THIS FILE COMPLETELY true if error exists

func ErrorLogger

func ErrorLogger(err error)

Types

type Config

type Config struct {
	AwsKey               string
	AwsSecret            string
	AwsRegion            string
	GdprQueueUrl         string
	CmsQueueUrl          string
	GdprCallbackQueueUrl string
	GdprBucket           string
	GdprBasePath         string
	SqsMaxMessages       int
	TimeWaitSeconds      int
}

func InitConfig

func InitConfig() (*Config, error)

type Context

type Context struct {
	Logger       logrus.FieldLogger
	Database     *db.Database
	UserPlayhead *model.UserPlayhead
	User         *model.User
}

type PublishMessage

type PublishMessage struct {
	UserUUID     string `json:"user_uuid" binding:"required"`
	S3Location   string `json:"s3_url" binding:"required"`
	RequestID    string `json:"request_id" binding:"required"`
	RequestType  string `json:"request_type" binding:"required"`
	ServiceName  string `json:"service_name" binding:"required"`
	ErrorMessage string `json:"error_message"`
	Success      bool   `json:"success" binding:"required"` // "true" || "false"
}

used to publish messages to SNS

type QMessage

type QMessage struct {
	Subject     string `json:"Subject"`
	Message     string `json:"Message"`
	MessageBody QMessageBody
}

type QMessageBody

type QMessageBody struct {
	UserUUID    string `json:"user_uuid" binding:"required"`
	RequestID   string `json:"request_id" binding:"required"`
	RequestType string `json:"request_type" binding:"required"`
	ServiceName string `json:"service_name" binding:"required"`
}

type Queue

type Queue struct {
	Config   *Config
	Database *db.Database
	Context  *Context
}

func New

func New() (q *Queue, err error)

func (*Queue) AddFileToS3

func (q *Queue) AddFileToS3(fileName string, content string) error

AddFileToS3 will upload a single file to S3, it will require a pre-built aws session and will set file info like content type and encryption on the uploaded file.

func (*Queue) Close

func (q *Queue) Close() error

func (*Queue) NewContext

func (q *Queue) NewContext() *Context

func (*Queue) PublishGdpr

func (q *Queue) PublishGdpr(message PublishMessage) error

TODO: make agnostic TODO: Should be able to handle all publishable messages

func (*Queue) StartCmsListener

func (q *Queue) StartCmsListener(ctx *Context)

func (*Queue) StartGdprListener

func (q *Queue) StartGdprListener(ctx *Context)

Jump to

Keyboard shortcuts

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