ListenLib

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const ReturnPacked = true

Variables

This section is empty.

Functions

func GetParam

func GetParam(Params []MsMessageParams, name string) string

func GetParamIndex

func GetParamIndex(Params []MsMessageParams, name string) int

func SlugToUUID

func SlugToUUID(slug string) (uuid string)

func StructToJson

func StructToJson(mm interface{}) (rv string)

func UUIDAsStr

func UUIDAsStr() (s_id string)

func UUIDAsStrPacked

func UUIDAsStrPacked() (s_id string)

func UUIDToSlug

func UUIDToSlug(uuid string) (slug string)

Types

type MsCfgType

type MsCfgType struct {
	ServerId string `json:"Sid"`      //
	Name     string `json:"QName"`    //	// Name of the Q to send stuff to //
	ReplyTTL uint64 `json:"ReplyTTL"` // how long will a reply last if not picked up.

	RedisConnectHost string     `json:"RedisConnectHost"` // Connection infor for Redis Database
	RedisConnectPort string     `json:"RedisConnectPort"` //
	RedisConnectAuth string     `json:"RedisConnectAuth"` //
	ReplyListenQ     string     `json:"ReplyListenQ"`     // Receives Wakie Wakie on Return
	RedisPool        *pool.Pool `json:"-"`                // Pooled Redis Client connectioninformation
	Err              error      `json:"-"`                // Error Holding Pen

	ReplyFx             map[string]*ReplyFxType             `json:"-"` //	Set of call/respond that we are waiting for answers on.
	DebugTimeoutMessage bool                                `json:"-"` // turn on/off the timeout 1ce a second message
	TickInMilliseconds  int                                 `json:"-"` // # of miliseconds for 1 tick
	ReplyFunc           func(replyMessage *MsMessageToSend) // function that will get when reply occures
	EventPattern        string                              `json:"EventPattern"` // Pattern for messages to listen to
	// contains filtered or unexported fields
}

Redis Connect Info ( 2 channels )

func NewMsCfgType

func NewMsCfgType(qName, qReply string) (ms *MsCfgType)

func (*MsCfgType) AddToFnMap

func (hdlr *MsCfgType) AddToFnMap(replace, fn, origFn, mt string)

ms.AddToFnMap(ms.GenCacheFn(id), url)

func (*MsCfgType) ConnectToRedis

func (hdlr *MsCfgType) ConnectToRedis() bool

func (*MsCfgType) Dump

func (ms *MsCfgType) Dump()

func (*MsCfgType) GenCacheFn

func (hdlr *MsCfgType) GenCacheFn(id, pth, urlPath string) string

ms.AddToFnMap(ms.GenCacheFn(id, path), url)

func (*MsCfgType) GetRedis

func (ms *MsCfgType) GetRedis() (conn *redis.Client)

GetRedis gets the redis connection

func (*MsCfgType) ListenForServer

func (ms *MsCfgType) ListenForServer(doWork WorkFuncType, wg *sync.WaitGroup)

func (*MsCfgType) PutRedis

func (ms *MsCfgType) PutRedis(conn *redis.Client)

PutRedis release the connection back to the connection pool

func (*MsCfgType) SetDbFlag

func (ms *MsCfgType) SetDbFlag(flag string, val bool)

func (*MsCfgType) SetEventPattern

func (ms *MsCfgType) SetEventPattern(pat string)

func (*MsCfgType) SetRedisConnectInfo

func (ms *MsCfgType) SetRedisConnectInfo(h, p, a string)

func (*MsCfgType) SetRedisPool

func (ms *MsCfgType) SetRedisPool(pool *pool.Pool)

setRedisPool - sets the redis poo info in the MsCfgType

Example:

micro := NewMsCfgType()
micro.SetRedisPool(hdlr.gCfg.RedisPool)

func (*MsCfgType) SetReplyFunc

func (ms *MsCfgType) SetReplyFunc(fx func(replyMessage *MsMessageToSend))

SetReplyFunc needs to be called before sending a message if you want a call/responce type operation. If you want message send and forget then do not call this with a 'fx', leave ms.ReplyFunc nil.

func (*MsCfgType) SetupListen

func (ms *MsCfgType) SetupListen()

func (*MsCfgType) TimeOutMessage

func (ms *MsCfgType) TimeOutMessage(f bool)

ms.TimeOutMessage(flag)

type MsMessageParams

type MsMessageParams struct {
	Name  string
	Value string
}

type MsMessageToSend

type MsMessageToSend struct {
	Id            string            `json:"Id"`                 // Unique id UUID for this message
	ActionId      string            `json:"ActionId,omitempty"` // Activity Hash ID -- unique to this activity
	GroupId       string            `json:"GroupId,omitempty"`  // Group of id's together ID -- unique to group
	CallId        string            `json:"CallId,omitempty"`   // Unique id for this call - if empty - generated and return
	ReplyTTL      uint64            `json:"ReplyTTL"`           // how long will a reply last if not picked up.
	To            string            `json:"-"`                  // Desitnation work Q - a name -
	ClientTimeout uint64            `json:"-"`                  // How long are you giving client to perform task
	Params        []MsMessageParams `json:"Params"`             // Set of params for client
	IsTimeout     bool              `json:"-"`                  // set on reply
}

type ReplyFxType

type ReplyFxType struct {
	Key        string                                                        // translated ID for reply
	IsTimedOut bool                                                          // Flag indicating timeout occured and fx called with that.
	IsDead     bool                                                          // Flag indicating timeout occured and fx called with that.
	TickCount  int                                                           // Number of time ticks encounted
	TickMax    int                                                           // Max before timeout is set
	Fx         func(data *MsMessageToSend, rx *ReplyFxType, isTimedOut bool) //function that will get called when Key is found
}

type WorkFuncType

type WorkFuncType func(arb map[string]interface{})

Jump to

Keyboard shortcuts

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