Documentation
¶
Index ¶
- Constants
- func Close()
- func Emit(channel string, data et.Json)
- func Error(event string, err error) error
- func Events() []string
- func HealthCheck() bool
- func HttpEventPublish(w http.ResponseWriter, r *http.Request)
- func Id() string
- func Load() error
- 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(Message)) (err error)
- func Reset() error
- func Source(channel string, f func(Message)) error
- func Stack(channel string, f func(Message)) error
- func Subscribe(channel string, f func(Message)) (err 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 EventEmiter
- type Handler
- type Message
- type WorkStatus
Constants ¶
View Source
const ( QUEUE_STACK = "stack" EVENT = "event" EVENT_LOG = "event:log" EVENT_OVERFLOW = "event:overflow" EVENT_WORK = "event:worker" EVENT_WORK_STATE = "event:worker:state" EVENT_SUBSCRIBED = "event:subscribed" )
View Source
const ( ERR_ENV_REQUIRED = "variables de entorno requerida (%s)" ERR_NOT_CONNECT = "no se conecto a nats" ERR_PARAM_NOT_FOUND = "parametro no encontrado" ERR_CLIENT_ID_EMPTY = "id de cliente esta vacio" ERR_CHANNEL_REQUIRED = "canal requerido" PARAMS_UPDATED = "parametros actualizados" )
View Source
const PackageName = "event"
Variables ¶
This section is empty.
Functions ¶
func HttpEventPublish ¶ added in v0.1.17
func HttpEventPublish(w http.ResponseWriter, r *http.Request)
* * HttpEventPublish * @param w http.ResponseWriter, r *http.Request *
func Unsubscribe ¶ added in v0.0.2
* * Unsubscribe * @param channel string * @return error *
Types ¶
type Conn ¶
func ConnectTo ¶
* * Connect to a host * @param host, user, password string * @return *Conn, error *
type EventEmiter ¶
type EventEmiter struct {
// contains filtered or unexported fields
}
func NewEventEmiter ¶
func NewEventEmiter() *EventEmiter
* * NewEventEmiter * @return *EventEmiter *
func (*EventEmiter) Emit ¶
func (s *EventEmiter) Emit(channel string, data et.Json)
* * Emit * @param channel string, data et.Json *
func (*EventEmiter) On ¶
func (s *EventEmiter) On(channel string, handler Handler)
* * On * @param channel string, handler Handler *
type Message ¶
type Message struct {
CreatedAt 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:"myself"`
}
func DecodeMessage ¶
* * DecodeMessage * @param []byte data * @return Message, error *
func NewEvenMessage ¶
* * NewEvenMessage * @param string channel * @param et.Json data * @return Message *
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 *
Click to show internal directories.
Click to hide internal directories.