consumer

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UUIDRegexp = regexp.MustCompile("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}")

UUIDRegexp enables to check if a string matches a UUID

Functions

This section is empty.

Types

type ConceptAnnotationsEvent added in v4.1.0

type ConceptAnnotationsEvent struct {
	ContentID   string `json:"uuid"`
	Annotations []struct {
		Thing struct {
			ID        string `json:"id"`
			Predicate string `json:"predicate"`
		} `json:"thing"`
	} `json:"annotations"`
}

type ContentQueueHandler added in v4.2.1

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

func NewContentQueueHandler added in v4.1.0

func NewContentQueueHandler(contentURIWhitelist *regexp.Regexp, contentTypeWhitelist *Set, mapper NotificationMapper, dispatcher notificationDispatcher, log *logger.UPPLogger) *ContentQueueHandler

NewContentQueueHandler returns a new message handler

func (*ContentQueueHandler) HandleMessage added in v4.2.1

func (qHandler *ContentQueueHandler) HandleMessage(queueMsg kafka.FTMessage) error

type MessageQueueHandler

type MessageQueueHandler interface {
	HandleMessage(queueMsg kafka.FTMessage) error
}

MessageQueueHandler is a generic interface for implementation of components to handle messages form the kafka queue.

type MessageQueueRouter added in v4.1.0

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

func NewMessageQueueHandler

func NewMessageQueueHandler(contentHandler, metadataHandler MessageQueueHandler) *MessageQueueRouter

func (*MessageQueueRouter) HandleMessage added in v4.1.0

func (h *MessageQueueRouter) HandleMessage(queueMsg kafka.FTMessage) error

type MetadataQueueHandler added in v4.2.1

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

func NewMetadataQueueHandler added in v4.1.0

func NewMetadataQueueHandler(originWhitelist []string, mapper NotificationMapper, dispatcher notificationDispatcher, log *logger.UPPLogger) *MetadataQueueHandler

func (*MetadataQueueHandler) HandleMessage added in v4.2.1

func (h *MetadataQueueHandler) HandleMessage(queueMsg kafka.FTMessage) error

func (*MetadataQueueHandler) IsAllowedOrigin added in v4.2.1

func (h *MetadataQueueHandler) IsAllowedOrigin(origin string) bool

type NotificationMapper

type NotificationMapper struct {
	APIBaseURL string
	Resource   string
	Property   PropertyReader
}

NotificationMapper maps CmsPublicationEvents to Notifications

func (NotificationMapper) MapMetadataNotification added in v4.1.0

func (n NotificationMapper) MapMetadataNotification(event ConceptAnnotationsEvent, transactionID string) dispatch.Notification

func (NotificationMapper) MapNotification

func (n NotificationMapper) MapNotification(event PublicationEvent, transactionID string) (dispatch.Notification, error)

MapNotification maps the given event to a new notification.

type NotificationQueueMessage

type NotificationQueueMessage struct {
	kafka.FTMessage
}

NotificationQueueMessage is a wrapper for the queue consumer message type

func (NotificationQueueMessage) HasCarouselTransactionID

func (msg NotificationQueueMessage) HasCarouselTransactionID() bool

HasCarouselTransactionID checks if the message is generated by the publish carousel

func (NotificationQueueMessage) HasSynthTransactionID

func (msg NotificationQueueMessage) HasSynthTransactionID() bool

HasSynthTransactionID checks if the message is synthetic

func (NotificationQueueMessage) OriginID added in v4.1.0

func (msg NotificationQueueMessage) OriginID() string

func (NotificationQueueMessage) ToAnnotationEvent added in v4.1.0

func (msg NotificationQueueMessage) ToAnnotationEvent() (ConceptAnnotationsEvent, error)

ToAnnotationEvent converts message to ConceptAnnotations Event

func (NotificationQueueMessage) ToPublicationEvent

func (msg NotificationQueueMessage) ToPublicationEvent() (event PublicationEvent, err error)

ToPublicationEvent converts the message to a CmsPublicationEvent

func (NotificationQueueMessage) TransactionID

func (msg NotificationQueueMessage) TransactionID() string

TransactionID returns the message TID

type PropertyReader added in v4.1.0

type PropertyReader interface {
	LastModified(event ConceptAnnotationsEvent) string
}

type PublicationEvent

type PublicationEvent struct {
	ContentURI        string
	ContentTypeHeader string
	LastModified      string
	Payload           interface{}
	UUID              string
}

PublicationEvent is the data structure that represents a publication event consumed from Kafka

func (PublicationEvent) HasEmptyPayload

func (e PublicationEvent) HasEmptyPayload() bool

HasEmptyPayload is a method that returns true if the PublicationEvent has an empty payload

func (PublicationEvent) Matches

func (e PublicationEvent) Matches(whitelist *regexp.Regexp) bool

Matches is a method that returns True if the ContentURI of a publication event matches a whitelist regexp

type Set

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

func NewSet

func NewSet() *Set

func (*Set) Add

func (s *Set) Add(value string)

func (*Set) Contains

func (s *Set) Contains(value string) bool

Jump to

Keyboard shortcuts

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