processor

package
v1.3.9-k8s-whitelist-u... Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CombinerOrigin = "forced-combined-msg"
	ContentType    = "application/json"
)
View Source
const (
	CombinerMessageType = "cms-combined-content-published"
)

Variables

View Source
var (
	NotFoundError           = errors.New("content not found") // used when the content can not be found by the platform
	InvalidContentTypeError = errors.New("invalid content type")
)

Functions

func NewProducerConfig

func NewProducerConfig(proxyAddress string, topic string, routingHeader string) producer.MessageProducerConfig

Types

type Annotation

type Annotation struct {
	Thing `json:"thing,omitempty"`
}

type Annotations

type Annotations struct {
	Annotations []Annotation `json:"annotations"`
	UUID        string       `json:"uuid"`
}

type CombinedModel

type CombinedModel struct {
	UUID     string       `json:"uuid"`
	Content  ContentModel `json:"content"`
	Metadata []Annotation `json:"metadata"`

	ContentURI    string `json:"contentUri"`
	LastModified  string `json:"lastModified"`
	MarkedDeleted string `json:"markedDeleted"`
}

type ContentModel

type ContentModel map[string]interface{}

type DataCombiner

type DataCombiner struct {
	ContentRetriever  contentRetrieverI
	MetadataRetriever metadataRetrieverI
}

func (DataCombiner) GetCombinedModel

func (dc DataCombiner) GetCombinedModel(uuid string) (CombinedModel, error)

func (DataCombiner) GetCombinedModelForAnnotations

func (dc DataCombiner) GetCombinedModelForAnnotations(metadata Annotations) (CombinedModel, error)

func (DataCombiner) GetCombinedModelForContent

func (dc DataCombiner) GetCombinedModelForContent(content ContentModel) (CombinedModel, error)

type DataCombinerI

type DataCombinerI interface {
	GetCombinedModelForContent(content ContentModel) (CombinedModel, error)
	GetCombinedModelForAnnotations(metadata Annotations) (CombinedModel, error)
	GetCombinedModel(uuid string) (CombinedModel, error)
}

func NewDataCombiner

func NewDataCombiner(docStoreApiUrl utils.ApiURL, annApiUrl utils.ApiURL, c utils.Client) DataCombinerI

type Forwarder

type Forwarder struct {
	MsgProducer           producer.MessageProducer
	SupportedContentTypes []string
}

func NewForwarder

func NewForwarder(msgProducer producer.MessageProducer, supportedContentTypes []string) Forwarder

type Identifier

type Identifier struct {
	Authority       string `json:"authority"`
	IdentifierValue string `json:"identifierValue"`
}

type KafkaQConsumer

type KafkaQConsumer struct {
	Consumer consumer.MessageConsumer
	// contains filtered or unexported fields
}

func NewKafkaQConsumer

func NewKafkaQConsumer(cConf consumer.QueueConfig, ch chan<- *KafkaQMessage, client *http.Client) *KafkaQConsumer

func (*KafkaQConsumer) ProcessMsg

func (c *KafkaQConsumer) ProcessMsg(m consumer.Message)

type KafkaQMessage

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

type MessageContent

type MessageContent struct {
	ContentURI   string       `json:"contentUri"`
	ContentModel ContentModel `json:"payload"`
	LastModified string       `json:"lastModified"`
}

type MsgProcessor

type MsgProcessor struct {
	DataCombiner DataCombinerI
	Forwarder    Forwarder
	// contains filtered or unexported fields
}

func NewMsgProcessor

func NewMsgProcessor(srcCh <-chan *KafkaQMessage, config MsgProcessorConfig, dataCombiner DataCombinerI, producer producer.MessageProducer, whitelistedContentTypes []string) *MsgProcessor

func (*MsgProcessor) ProcessMessages

func (p *MsgProcessor) ProcessMessages()

type MsgProcessorConfig

type MsgProcessorConfig struct {
	SupportedContentURIs []string
	SupportedHeaders     []string
	ContentTopic         string
	MetadataTopic        string
}

func NewMsgProcessorConfig

func NewMsgProcessorConfig(supportedURIs []string, supportedHeaders []string, contentTopic string, metadataTopic string) MsgProcessorConfig

type QConsumer

type QConsumer interface {
	ProcessMsg(m consumer.Message)
}

type RequestProcessor

type RequestProcessor struct {
	DataCombiner DataCombinerI
	Forwarder    Forwarder
}

func NewRequestProcessor

func NewRequestProcessor(dataCombiner DataCombinerI, producer producer.MessageProducer, whitelistedContentTypes []string) *RequestProcessor

func (*RequestProcessor) ForceMessagePublish

func (p *RequestProcessor) ForceMessagePublish(uuid string, tid string) error

type RequestProcessorI

type RequestProcessorI interface {
	ForceMessagePublish(uuid string, tid string) error
}

type Thing

type Thing struct {
	ID        string   `json:"id,omitempty"`
	PrefLabel string   `json:"prefLabel,omitempty"`
	Types     []string `json:"types,omitempty"`
	Predicate string   `json:"predicate,omitempty"`
	ApiUrl    string   `json:"apiUrl,omitempty"`
}

Jump to

Keyboard shortcuts

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