instance

package
v0.0.0-...-12a776e Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PREPARE  = "prepare"  // instance is created, but not yet running
	READY    = "ready"    // instance is running and waiting for messages to handle
	HANDLING = "handling" // instance is running, but busy by handling messages
	CLOSED   = "close"    // instance was closed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	Id string
	// contains filtered or unexported fields
}

The Instance is the socket wrapper for the handler instance

The instances have three sockets: Push to send its status to the handler Sub to receive the messages from the handler HandlerType socket to handle the messages.

If parent is PUB Then, Instances are per Topic. The instances are sub that receives the messages and then sends it to the parent.

If parent is Replier Then, the user manages Instances.

The publisher returns two clients.

func New

func New(handlerType config.HandlerType, id string, parentId string, parent *log.Logger) *Instance

New handler of the handlerType

func (*Instance) SetClients

func (c *Instance) SetClients(clients *key_value.KeyValue)

SetClients set the reference to the socket clients

func (*Instance) SetMessageOps

func (c *Instance) SetMessageOps(ops *message.Operations)

func (*Instance) SetRoutes

func (c *Instance) SetRoutes(routes *key_value.KeyValue, routeDeps *key_value.KeyValue)

SetRoutes set the reference to the functions and dependencies from the Handler.

func (*Instance) Start

func (c *Instance) Start() error

Start the instance manager and handler in the internal goroutine. It waits until the sockets are bound to the endpoints. If until the binding occurs an error, then it will return it back.

After binding, the occurred errors are sent back to the instance manager by the pub socket.

If pub socket had an error then, the errors are printed to stderr

func (*Instance) Status

func (c *Instance) Status() string

Status of the instance

func (*Instance) Type

func (c *Instance) Type() config.HandlerType

Type returns the type of the instances

Jump to

Keyboard shortcuts

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