notification

package
v0.0.0-...-cf36c3e Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchDestination = fmt.Errorf("no such destination exists")

Functions

This section is empty.

Types

type CRDBPersistence

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

func NewCRDBPersistence

func NewCRDBPersistence(pool *pgxpool.Pool) *CRDBPersistence

func (*CRDBPersistence) Get

func (crdbp *CRDBPersistence) Get(ctx context.Context, notifUUID uuid.UUID, tx pgx.Tx) (*Notification, error)

func (*CRDBPersistence) GetPool

func (crdbp *CRDBPersistence) GetPool() *pgxpool.Pool

func (*CRDBPersistence) InsertIfNotExists

func (crdbp *CRDBPersistence) InsertIfNotExists(ctx context.Context, notification *Notification, tx pgx.Tx) (int64, error)

type DelegatingNotification

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

type DelegatingNotificator

type DelegatingNotificator struct {
	Notificators []Notificator
}

func (*DelegatingNotificator) DelegateNotification

func (dn *DelegatingNotificator) DelegateNotification(notification *DelegatingNotification) error

type Destination

type Destination int8
const (
	SMS Destination = iota
	Email
	Slack
)

type EmailNotificator

type EmailNotificator struct {
}

func (*EmailNotificator) Destination

func (sn *EmailNotificator) Destination() Destination

func (*EmailNotificator) Send

func (en *EmailNotificator) Send(txt string) error

type Endpoint

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

func NewEndpoint

func NewEndpoint(svc InternalManager) *Endpoint

func (*Endpoint) CreateNotification

func (e *Endpoint) CreateNotification(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

type InternalManager

type InternalManager interface {
	PushNotificationInternal(notification *Request) error
}

type InternalService

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

func NewInternalService

func NewInternalService(outstandingNotificationsProducer *messaging.KafkaProducer,
	persistence *CRDBPersistence) (*InternalService, error)

func (*InternalService) PushNotificationInternal

func (s *InternalService) PushNotificationInternal(n *Request) error

type Notification

type Notification struct {
	UUID                    uuid.UUID   `json:"uuid"`
	ServerReceivedTimestamp time.Time   `json:"server_received_timestamp"`
	NotificationTxt         string      `json:"txt"`
	Dest                    Destination `json:"destination"`
}

type Notificator

type Notificator interface {
	Send(txt string) error
	Destination() Destination
}

type OutstandingNotification

type OutstandingNotification struct {
	UUID uuid.UUID `json:"uuid"`
}

type OutstandingService

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

func NewOutstandingService

func NewOutstandingService(
	bootstrapServers, outstandingGroupID, autoResetOffset, enableAutoCommit, outstandingNotificationsTopic string, persistence *CRDBPersistence,
	notificator *DelegatingNotificator, maxRoutines int) (*OutstandingService, error)

func (*OutstandingService) Stop

func (ous *OutstandingService) Stop()

type Request

type Request struct {
	UUID            string `json:"uuid"`
	NotificationTxt string `json:"txt"`
	Destination     string `json:"destination"`
}

type SMSNotificator

type SMSNotificator struct {
}

func (*SMSNotificator) Destination

func (sn *SMSNotificator) Destination() Destination

func (*SMSNotificator) Send

func (smsn *SMSNotificator) Send(txt string) error

type SlackNotificator

type SlackNotificator struct {
}

func (*SlackNotificator) Destination

func (sn *SlackNotificator) Destination() Destination

func (*SlackNotificator) Send

func (sn *SlackNotificator) Send(txt string) error

Directories

Path Synopsis
Package notificationmocks is a generated GoMock package.
Package notificationmocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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