messagehandler

package
v0.0.0-...-955c50f Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package messagehandler defines methods to be used by Interactors for submission of commands to the processors through ProcessorWrappers It also forwards the replies receives from processor wrapper

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorCode

type ErrorCode string
const (
	// Name represents name of the service
	Name = "MessageHandler"

	// UnexpectedDocumentType represents that message handler received unexpected document type
	UnexpectedDocumentType ErrorCode = "UnexpectedDocumentType"

	// ProcessorBufferFull represents that the processor buffer is full
	ProcessorBufferFull ErrorCode = "ProcessorBufferFull"

	// ClosedProcessor represents that the processor is closed
	ClosedProcessor ErrorCode = "ClosedProcessor"

	// ProcessorErrorCodeTranslationFailed represents that the processor to message handler error code translation failed
	ProcessorErrorCodeTranslationFailed ErrorCode = "ProcessorErrorCodeTranslationFailed"

	// DuplicateCommand represents duplicate command in the buffer
	DuplicateCommand ErrorCode = "DuplicateCommand"

	// InvalidDocument represents invalid document received in processor
	InvalidDocument ErrorCode = "InvalidDocument"

	// ContainerNotSupported represents agent job messages are not supported for containers
	ContainerNotSupported ErrorCode = "ContainerNotSupported"

	// AgentJobMessageParseError represents agent job messages cannot be parsed to Document State
	AgentJobMessageParseError ErrorCode = "AgentJobMessageParseError"

	// UnexpectedError represents unexpected error
	UnexpectedError ErrorCode = "UnexpectedError"

	// Successful represent agent job messages can be processed successfully
	Successful ErrorCode = "Successful"
)

type IMessageHandler

type IMessageHandler interface {
	GetName() string
	Initialize() error
	InitializeAndRegisterProcessor(proc processorWrapperTypes.IProcessorWrapper) error
	RegisterReply(name contracts.UpstreamServiceName, reply chan contracts.DocumentResult)
	Submit(message *contracts.DocumentState) ErrorCode
	Stop() (err error)
}

func NewMessageHandler

func NewMessageHandler(context context.T) IMessageHandler

NewMessageHandler returns new message handler

type MessageHandler

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

MessageHandler defines methods to be used by Interactors for submission of commands to the processors through ProcessorWrappers

func (*MessageHandler) GetName

func (mh *MessageHandler) GetName() string

GetName returns the name

func (*MessageHandler) Initialize

func (mh *MessageHandler) Initialize() (err error)

Initialize initializes MessageHandler

func (*MessageHandler) InitializeAndRegisterProcessor

func (mh *MessageHandler) InitializeAndRegisterProcessor(proc processorWrapperTypes.IProcessorWrapper) error

InitializeAndRegisterProcessor registers processors from Message service Should be called before Initialization being called

func (*MessageHandler) RegisterReply

func (mh *MessageHandler) RegisterReply(name contracts.UpstreamServiceName, reply chan contracts.DocumentResult)

RegisterReply registers the reply to the MessageHandler

func (*MessageHandler) Stop

func (mh *MessageHandler) Stop() (err error)

Stop stops the message handlers

func (*MessageHandler) Submit

func (mh *MessageHandler) Submit(message *contracts.DocumentState) ErrorCode

Submit submits the command to the processor wrapper

Directories

Path Synopsis
Package idempotency implements methods to maintain idempotency with the commands received
Package idempotency implements methods to maintain idempotency with the commands received
Package processorwrappers implements different processor wrappers to handle the processors which launches document worker and session worker for now
Package processorwrappers implements different processor wrappers to handle the processors which launches document worker and session worker for now

Jump to

Keyboard shortcuts

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