Documentation ¶
Index ¶
- Constants
- func GetParam(Params []MsMessageParams, name string) string
- func GetParamIndex(Params []MsMessageParams, name string) int
- func SlugToUUID(slug string) (uuid string)
- func StructToJson(mm interface{}) (rv string)
- func UUIDAsStr() (s_id string)
- func UUIDAsStrPacked() (s_id string)
- func UUIDToSlug(uuid string) (slug string)
- type MsCfgType
- func (hdlr *MsCfgType) AddToFnMap(replace, fn, origFn, mt string)
- func (hdlr *MsCfgType) ConnectToRedis() bool
- func (ms *MsCfgType) Dump()
- func (hdlr *MsCfgType) GenCacheFn(id, pth, urlPath string) string
- func (ms *MsCfgType) GetRedis() (conn *redis.Client)
- func (ms *MsCfgType) ListenFor()
- func (ms *MsCfgType) ListenForServer(doWork WorkFuncType, wg *sync.WaitGroup)
- func (ms *MsCfgType) PutRedis(conn *redis.Client)
- func (ms *MsCfgType) ReceiveGroupReply()
- func (ms *MsCfgType) SendMessage(mm *MsMessageToSend)
- func (ms *MsCfgType) SetDbFlag(flag string, val bool)
- func (ms *MsCfgType) SetRedisConnectInfo(h, p, a string)
- func (ms *MsCfgType) SetRedisPool(pool *pool.Pool)
- func (ms *MsCfgType) SetReplyFunc(fx func(replyMessage *MsMessageToSend))
- func (ms *MsCfgType) SetupListen()
- func (ms *MsCfgType) SetupListenServer()
- func (ms *MsCfgType) SvrListenForMessage()
- func (ms *MsCfgType) TimeOutMessage(f bool)
- type MsMessageParams
- type MsMessageToSend
- type ReplyFxType
- type WorkFuncType
Constants ¶
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 StructToJson ¶
func StructToJson(mm interface{}) (rv string)
func UUIDAsStrPacked ¶
func UUIDAsStrPacked() (s_id string)
func UUIDToSlug ¶
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 // contains filtered or unexported fields }
Redis Connect Info ( 2 channels )
func NewMsCfgType ¶
func (*MsCfgType) AddToFnMap ¶
ms.AddToFnMap(ms.GenCacheFn(id), url)
func (*MsCfgType) ConnectToRedis ¶
func (*MsCfgType) GenCacheFn ¶
ms.AddToFnMap(ms.GenCacheFn(id, path), url)
func (*MsCfgType) ListenForServer ¶
func (ms *MsCfgType) ListenForServer(doWork WorkFuncType, wg *sync.WaitGroup)
func (*MsCfgType) ReceiveGroupReply ¶
func (ms *MsCfgType) ReceiveGroupReply()
ReceiveGroupReply() is the way to receive a reply to a group or timeout reply to a group of message. It will call it's worker function as soon as all of the group have had a reply or when the timeout specified occures.
The replay pub/sub is w-r:Name The replay data is w-d:Id - this is a set/list of data that are replies -- Reply Template
func (*MsCfgType) SendMessage ¶
func (ms *MsCfgType) SendMessage(mm *MsMessageToSend)
func (*MsCfgType) SetRedisConnectInfo ¶
func (*MsCfgType) SetRedisPool ¶
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) SetupListenServer ¶
func (ms *MsCfgType) SetupListenServer()
func (*MsCfgType) SvrListenForMessage ¶
func (ms *MsCfgType) SvrListenForMessage()
SvrListenForMessage() is the serve function that performs 1. Listen on the Redis pub/sub for wakie-wakie 2. Periodic self-ping to wake up and check Q (1ce every 10 sec - configurable)
func (*MsCfgType) TimeOutMessage ¶
ms.TimeOutMessage(flag)
type MsMessageParams ¶
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 SendBackTo string `json:"SendBackTo"` // -- send message to -- WakieWakie 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{})