messaging

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotModified = errors.New("not modified")

ErrNotModified is used for Etag and Last-Modified handling

Functions

func NewFeedsUpdateProducer

func NewFeedsUpdateProducer(producer MessageProducer) *rssFeedsUpdateProducer

func NewRSSFeedsProcessor

func NewRSSFeedsProcessor(repository FeedsRepository, feedsUpdateProducer RSSFeedsUpdateProducer, logger logger.Logger) *rssFeedsProcessor

NewRSSFeedsProcessor creates processor for messaging feeds operations

Types

type FeedsRepository

type FeedsRepository interface {
	GetAll() ([]entity.Feed, error)
	GetByPublicationUUID(uuid.UUID) (*entity.Feed, error)
	GetFeedHTTPMetadataByPublicationUUID(uuid.UUID) (*entity.FeedHTTPMetadata, error)
	SaveFeedHTTPMetadata(*entity.FeedHTTPMetadata) error
	SaveProcessedItem(*entity.ProcessedItem) error
	ProcessedItemExists(*entity.ProcessedItem) (bool, error)
}

FeedsRepository defines repository methods

type FeedsUpdateAllMsg

type FeedsUpdateAllMsg struct {
}

type FeedsUpdateOneMsg

type FeedsUpdateOneMsg struct {
	PublicationUUID uuid.UUID `json:"publication_uuid,string"`
}

type MessageEnvelope

type MessageEnvelope struct {
	Type MessageType `json:"type,int"`
	Msg  interface{}
}

MessageEnvelope defines shared fields for MQ message with message type as action key and Msg as actual message body content

func NewFeedsUpdateAllMessage

func NewFeedsUpdateAllMessage() *MessageEnvelope

NewFeedsUpdateAllMsg returns message with action to update all feeds

func NewFeedsUpdateOneMessage

func NewFeedsUpdateOneMessage(publicationUUID uuid.UUID) *MessageEnvelope

NewFeedsUpdateOneMsg returns message with action to update one feed

type MessageProducer

type MessageProducer interface {
	Publish([]byte) error
}

type MessageType

type MessageType uint

MessageType defines types of messages

const (
	FeedsUpdateOne MessageType = iota
	FeedsUpdateAll
)

func (MessageType) String

func (i MessageType) String() string

type RSSFeedsUpdateProducer

type RSSFeedsUpdateProducer interface {
	SendUpdateOne(uuid.UUID) error
	SendUpdateAll() error
}

RSSFeedsUpdateProducer provides methods to call update (refresh news from) RSS Feed via messaging subsystem

type RssFeed

type RssFeed struct {
	*gofeed.Feed

	ETag         string
	LastModified time.Time
}

RssFeed is extended feed with etag and lastmodified

Directories

Path Synopsis
nsqclient

Jump to

Keyboard shortcuts

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