mediator

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 12 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// InvalidRequestErrorCode for invalid requests.
	InvalidRequestErrorCode = command.Code(iota + command.ROUTE)

	// ResponseWriteErrorCode for connection ID validation error.
	RegisterMissingConnIDCode

	// RegisterRouterErrorCode for register router error.
	RegisterRouterErrorCode

	// UnregisterRouterErrorCode for unregister router error.
	UnregisterRouterErrorCode

	// Connection for get connection id error.
	GetConnectionIDErrorCode

	// ReconnectMissingConnIDCode for connection ID validation error.
	ReconnectMissingConnIDCode

	// ReconnectRouterErrorCode for reconnecting router error.
	ReconnectRouterErrorCode

	// StatusRequestMissingConnIDCode for connection ID validation error.
	StatusRequestMissingConnIDCode

	// StatusRequestErrorCode for status request error.
	StatusRequestErrorCode

	// BatchPickupMissingConnIDCode for connection ID validation error.
	BatchPickupMissingConnIDCode

	// BatchPickupRequestErrorCode for batch pick up error.
	BatchPickupRequestErrorCode
)

Error codes

View Source
const (
	// command name
	CommandName = "mediator"

	// command methods
	RegisterCommandMethod        = "Register"
	UnregisterCommandMethod      = "Unregister"
	GetConnectionIDCommandMethod = "Connection"
	ReconnectCommandMethod       = "Reconnect"
	StatusCommandMethod          = "Status"
	BatchPickupCommandMethod     = "BatchPickup"
)

constant for the mediator controller

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchPickupRequest

type BatchPickupRequest struct {
	// ConnectionID of connection for which pending messages needs to be dispatched.
	ConnectionID string `json:"connectionID"`
	// Size of batch of pending messages to be dispatched.
	Size int `json:"batch_size"`
}

BatchPickupRequest is request for dispatching pending messages.

type BatchPickupResponse

type BatchPickupResponse struct {
	// Count of messages dispatched.
	MessageCount int `json:"message_count"`
}

BatchPickupResponse is response for dispatching pending messages.

type Command

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

Command contains command operations provided by route controller.

func New

func New(ctx provider, autoAccept bool) (*Command, error)

New returns new route controller command instance.

func (*Command) BatchPickup

func (o *Command) BatchPickup(rw io.Writer, req io.Reader) command.Error

BatchPickup dispatches pending messages for given connection.

func (*Command) Connection

func (o *Command) Connection(rw io.Writer, req io.Reader) command.Error

Connection returns the connectionID of the router.

func (*Command) GetHandlers

func (o *Command) GetHandlers() []command.Handler

GetHandlers returns list of all commands supported by this controller command.

func (*Command) Reconnect

func (o *Command) Reconnect(rw io.Writer, req io.Reader) command.Error

Reconnect sends noop message to reestablish a connection when there is no other reason to message the mediator nolint:dupl

func (*Command) Register

func (o *Command) Register(rw io.Writer, req io.Reader) command.Error

Register registers the agent with the router. nolint:dupl

func (*Command) Status

func (o *Command) Status(rw io.Writer, req io.Reader) command.Error

Status returns details about pending messages for given connection.

func (*Command) Unregister

func (o *Command) Unregister(rw io.Writer, req io.Reader) command.Error

Unregister unregisters the agent with the router.

type RegisterRoute

type RegisterRoute struct {
	ConnectionID string `json:"connectionID"`
}

RegisterRoute contains parameters for registering/reconnecting router.

type StatusRequest

type StatusRequest struct {
	ConnectionID string `json:"connectionID"`
}

StatusRequest is request for getting details about pending messages.

type StatusResponse

type StatusResponse struct {
	*messagepickup.Status
}

StatusResponse is status response containing details about pending messages.

Jump to

Keyboard shortcuts

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