Documentation ¶
Index ¶
- Constants
- type Instance
- func (c *Instance) SetClients(clients *key_value.KeyValue)
- func (c *Instance) SetMessageOps(ops *message.Operations)
- func (c *Instance) SetRoutes(routes *key_value.KeyValue, routeDeps *key_value.KeyValue)
- func (c *Instance) Start() error
- func (c *Instance) Status() string
- func (c *Instance) Type() config.HandlerType
Constants ¶
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 ¶
SetClients set the reference to the socket clients
func (*Instance) SetMessageOps ¶
func (c *Instance) SetMessageOps(ops *message.Operations)
func (*Instance) SetRoutes ¶
SetRoutes set the reference to the functions and dependencies from the Handler.
func (*Instance) Start ¶
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) Type ¶
func (c *Instance) Type() config.HandlerType
Type returns the type of the instances