consumer

package
v3.0.9+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2017 License: MIT Imports: 7 Imported by: 1

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 MessageQueueHandler

type MessageQueueHandler interface {
	HandleMessage(queueMsg []queueConsumer.Message)
}

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

func NewMessageQueueHandler

func NewMessageQueueHandler(whitelist *regexp.Regexp, mapper NotificationMapper, dispatcher dispatcher.Dispatcher) MessageQueueHandler

NewMessageQueueHandler returns a new message handler

type NotificationMapper

type NotificationMapper struct {
	APIBaseURL string
	Resource   string
}

NotificationMapper maps CmsPublicationEvents to Notifications

func (NotificationMapper) MapNotification

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

MapNotification maps the given event to a new notification.

type NotificationQueueMessage

type NotificationQueueMessage struct {
	queueConsumer.Message
}

NotificationQueueMessage is a wrapper for the queue consumer message type

func (NotificationQueueMessage) HasCarouselTransactionID

func (msg NotificationQueueMessage) HasCarouselTransactionID() bool

HasCarouselTransactionID checks if the message is genearted by the publish carousel

func (NotificationQueueMessage) HasSynthTransactionID

func (msg NotificationQueueMessage) HasSynthTransactionID() bool

HasSynthTransactionID checks if the message is synthetic

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 PublicationEvent

type PublicationEvent struct {
	ContentURI   string
	UUID         string
	Payload      interface{}
	LastModified 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 playload

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

Jump to

Keyboard shortcuts

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