Documentation
¶
Index ¶
- Constants
- func Close()
- func Emit(channel string, data et.Json)
- func HealthCheck() bool
- func HttpEventWork(w http.ResponseWriter, r *http.Request)
- func Id() string
- func Log(event string, data et.Json)
- func On(channel string, handler Handler)
- func Overflow(data et.Json)
- func Publish(channel string, data et.Json) error
- func Queue(channel, queue string, f func(EvenMessage)) error
- func Source(model, action string, data et.Json) et.Json
- func Stack(channel string, f func(EvenMessage)) error
- func Subscribe(channel string, f func(EvenMessage)) error
- func Unsubscribe(channel string) error
- func Work(event string, data et.Json) et.Json
- func WorkState(work_id string, status WorkStatus, data et.Json)
- type Conn
- type EvenMessage
- type EventEmiter
- type Handler
- type Message
- type WorkStatus
Constants ¶
const ( EVENT = "event" EVENT_LOG = "event:log" EVENT_OVERFLOW = "event:requests:overflow" EVENT_WORK = "event:worker" EVENT_WORK_STATE = "event:worker:state" EVENT_SUBSCRIBED = "event:subscribed" EVENT_SOURCE = "event:source" )
const ( ERR_ENV_REQUIRED = "variables de entorno requerida (%s)" ERR_NOT_CONNECT = "not connect nats" ERR_PARAM_NOT_FOUND = "param not found" ERR_CLIENT_ID_EMPTY = "client id is empty" ERR_CHANNEL_REQUIRED = "channel is required" PARAMS_UPDATED = "Params updated" )
const QUEUE_STACK = "stack"
Variables ¶
This section is empty.
Functions ¶
func HttpEventWork ¶ added in v1.1.0
func HttpEventWork(w http.ResponseWriter, r *http.Request)
* * HttpEventWork * @param w http.ResponseWriter, r *http.Request *
func Queue ¶
func Queue(channel, queue string, f func(EvenMessage)) error
* * Queue * @param string channel, string queue, func(EvenMessage) f * @return error *
func Source ¶
* * Source * @param string model, string action, string err, data et.Json * @return error *
func Stack ¶
func Stack(channel string, f func(EvenMessage)) error
* * Stack * @param channel string, f func(EvenMessage) * @return error *
func Subscribe ¶
func Subscribe(channel string, f func(EvenMessage)) error
* * Subscribe * @param channel string, f func(EvenMessage) * @return error *
func Unsubscribe ¶ added in v1.1.142
* * Unsubscribe * @param channel string * @return error *
Types ¶
type Conn ¶
func ConnectTo ¶ added in v1.1.30
* * ConnectTo * @param host, user, password string * @return *Conn, error *
type EvenMessage ¶
type EvenMessage struct {
Created_at time.Time `json:"created_at"`
FromId string `json:"from_id"`
Id string `json:"id"`
Channel string `json:"channel"`
Data et.Json `json:"data"`
MySelf bool `json:"my_self"`
}
func DecodeMessage ¶
func DecodeMessage(data []byte) (EvenMessage, error)
* * DecodeMessage * @param []byte data * @return EvenMessage, error *
func NewEvenMessage ¶
func NewEvenMessage(channel string, data et.Json) EvenMessage
* * NewEvenMessage * @param string channel * @param et.Json data * @return EvenMessage *
func (EvenMessage) Encode ¶
func (m EvenMessage) Encode() ([]byte, error)
* * Encode * @return []byte, error *
func (EvenMessage) ToJson ¶
func (m EvenMessage) ToJson() (et.Json, error)
* * ToJson * @return et.Json, error *
func (EvenMessage) ToString ¶
func (m EvenMessage) ToString() string
* * ToString * @return string *
type EventEmiter ¶ added in v1.1.82
type EventEmiter struct {
// contains filtered or unexported fields
}
func NewEventEmiter ¶ added in v1.1.82
func NewEventEmiter() *EventEmiter
* * NewEventEmiter * @return *EventEmiter *
func (*EventEmiter) Emit ¶ added in v1.1.82
func (s *EventEmiter) Emit(channel string, data et.Json)
* * Emit * @param channel string, data et.Json *
func (*EventEmiter) On ¶ added in v1.1.82
func (s *EventEmiter) On(channel string, handler Handler)
* * On * @param channel string, handler Handler *
type Handler ¶ added in v1.1.82
type Handler func(message EvenMessage)
type WorkStatus ¶
type WorkStatus int
const ( WorkStatusPending WorkStatus = iota WorkStatusAccepted WorkStatusProcessing WorkStatusCompleted WorkStatusFailed )
func ToWorkStatus ¶
func ToWorkStatus(n int) WorkStatus
* * ToWorkStatus * @param int n * @return WorkStatus *