event

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 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"
	PARAMS_UPDATED      = "Params updated"
)
View Source
const EVENT_LAT_TOKEN_USE = "telemetry.token.last_use"
View Source
const EVENT_LOG = "log"
View Source
const EVENT_OVERFLOW = "requests/overflow"
View Source
const EVENT_TELEMETRY = "telemetry"
View Source
const EVENT_WORK = "event/worker"
View Source
const EVENT_WORK_STATE = "event/worker/state"
View Source
const PackageName = "event"
View Source
const QUEUE_STACK = "stack"

Variables

This section is empty.

Functions

func Close

func Close()

* * Close the connection to the service pubsub *

func Data added in v0.0.4

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

* * Data * @param string channel * @param func(Message) reciveFn * @return error *

func FromId added in v0.0.9

func FromId() string

* * FromId return the id of the connection * @return string *

func HttpEventWork added in v0.0.9

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 added in v0.0.4

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

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

func Source added in v0.0.4

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

* * Source * @param string channel * @param func(Message) reciveFn * @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)) (err 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 added in v0.0.4

func TokenLastUse(data et.Json)

* * TokenLastUse * @param data et.Json *

func Work added in v0.0.4

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

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

func WorkState added in v0.0.4

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 added in v0.0.4

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

func ConnectTo added in v0.0.9

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

func Load

func Load() (*Conn, error)

* * Load the connection to the service pubsub * @return *Conn, error *

type EvenMessage added in v0.0.4

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 added in v0.0.4

func DecodeMessage(data []byte) (EvenMessage, error)

* * DecodeMessage * @param []byte data * @return EvenMessage, error *

func NewEvenMessage added in v0.0.4

func NewEvenMessage(channel string, data et.Json) EvenMessage

* * NewEvenMessage * @param string channel * @param et.Json data * @return EvenMessage *

func (EvenMessage) Encode added in v0.0.4

func (m EvenMessage) Encode() ([]byte, error)

* * Encode * @return []byte, error *

func (EvenMessage) ToJson added in v0.0.4

func (m EvenMessage) ToJson() (et.Json, error)

* * ToJson * @return et.Json, error *

func (EvenMessage) ToString added in v0.0.4

func (m EvenMessage) ToString() string

* * ToString * @return string *

type Message added in v0.0.4

type Message interface {
	Type() string
}

type WorkStatus added in v0.0.4

type WorkStatus int
const (
	WorkStatusPending WorkStatus = iota
	WorkStatusAccepted
	WorkStatusProcessing
	WorkStatusCompleted
	WorkStatusFailed
)

func ToWorkStatus added in v0.0.4

func ToWorkStatus(n int) WorkStatus

* * ToWorkStatus * @param int n * @return WorkStatus *

func (WorkStatus) String added in v0.0.4

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