event

package
v1.1.72 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View 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"
)

Variables

View Source
var FromId string

Functions

func Close

func Close()

func HttpEventWork added in v1.1.0

func HttpEventWork(w http.ResponseWriter, r *http.Request)

* * HttpEventWork * @param w http.ResponseWriter * @param r *http.Request *

func Log

func Log(event string, data et.Json)

* * Log * @param event string * @param data et.Json *

func Overflow

func Overflow(data et.Json)

* * Overflow * @param data et.Json *

func Publish

func Publish(channel string, data et.Json) error

* * Publish * @param channel string * @param data et.Json * @return error *

func Queue

func Queue(channel, queue string, f func(EvenMessage)) error

* * Queue * @param string channel * @param func(EvenMessage) f * @return error *

func Source

func Source(model, action, err string, data et.Json) et.Json

* * Source * @param string channel * @param data et.Json * @return error *

func Stack

func Stack(channel string, f func(EvenMessage)) error

* * Stack * @param channel string * @param f func(EvenMessage) * @return error *

func Subscribe

func Subscribe(channel string, f func(EvenMessage)) error

* * Subscribe * @param channel string * @param f func(EvenMessage) * @return error *

func Telemetry

func Telemetry(data et.Json)

* * Telemetry * @param data et.Json *

func TokenLastUse

func TokenLastUse(data et.Json)

* * TokenLastUse * @param data et.Json *

func Work

func Work(event string, data et.Json) et.Json

* * Work * @param event string * @param data et.Json *

func WorkState

func WorkState(work_id string, status WorkStatus, data et.Json)

* * WorkState * @param work_id string * @param status WorkStatus * @param data et.Json *

Types

type Conn

type Conn struct {
	*nats.Conn
	// contains filtered or unexported fields
}

func ConnectTo added in v1.1.30

func ConnectTo(host, user, password string) (*Conn, error)

func Load

func Load() (*Conn, error)

type EvenMessage

type EvenMessage struct {
	Created_at time.Time `json:"created_at"`
	Id         string    `json:"id"`
	Channel    string    `json:"channel"`
	Data       et.Json   `json:"data"`
}

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 Message

type Message interface {
	Type() string
}

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 *

func (WorkStatus) String

func (s WorkStatus) String() string

* * String * @return string *

Jump to

Keyboard shortcuts

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