nats

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindTaskToEvent

func BindTaskToEvent(event Event, triggerTask Task)

func BindTaskToEventAndMakePayload

func BindTaskToEventAndMakePayload[T PayloadType, TriggerTaskDataType PayloadType](
	event Event, triggerTask Task, fetchTaskData func(eventData T) (TriggerTaskDataType, error),
)

func PublishEvent

func PublishEvent(event Event) (isSuccess bool)

func PublishEventToOutboxWithPayload

func PublishEventToOutboxWithPayload[T PayloadType](ctx context.Context, event Event, payload T) error

func PublishEventWithPayload

func PublishEventWithPayload[T PayloadType](event Event, fetchTaskData T) (isSuccess bool)

func PublishTask

func PublishTask(task Task) (isSuccess bool)

func PublishTaskToOutbox

func PublishTaskToOutbox(ctx context.Context, task Task) error

PublishTaskToOutbox Must be used in a transaction,see db.Transaction

func PublishTaskToOutboxWithPayload

func PublishTaskToOutboxWithPayload[T PayloadType](ctx context.Context, task Task, payload T) error

PublishTaskToOutboxWithPayload Must be used in a transaction,see db.Transaction

func PublishTaskWithPayload

func PublishTaskWithPayload[T PayloadType](task Task, payload T) (isSuccess bool)

func RepublishDieMsg

func RepublishDieMsg(batch int, ctx context.Context) error

func SubscribeEvent

func SubscribeEvent[T PayloadType](event Event, name string, handleTransaction handler[T])

func SubscribeTask

func SubscribeTask(task Task, handler func(ctx context.Context) error)

func SubscribeTaskWithPayload

func SubscribeTaskWithPayload[T PayloadType](task Task, handle handler[T])

func SubscribeTaskWithPayloadAndProcessInTransaction

func SubscribeTaskWithPayloadAndProcessInTransaction[T PayloadType](task Task, handleTransaction handler[T])

Types

type Event

type Event = manager.Event
const EventOutbox Event = "outbox"
const EventTransactionCreate Event = "transaction_create_event"
const EventTransactionDelete Event = "transaction_delete_event"
const EventTransactionUpdate Event = "transaction_update_event"

type EventTransactionUpdatePayload

type EventTransactionUpdatePayload struct {
	OldTrans, NewTrans transactionModel.Transaction
}

type PayloadSendCaptchaEmail

type PayloadSendCaptchaEmail struct {
	Email  string
	Action constant.UserAction
}

type PayloadSendNotificationEmail

type PayloadSendNotificationEmail struct {
	UserId       uint
	Notification constant.Notification
}

type PayloadType

type PayloadType interface{}

type Task

type Task = manager.Task
const TaskCreateTourist Task = "createTourist"

user task

const TaskMappingCategoryToAccountMapping Task = "mappingCategoryToAccountMapping"

category task

const TaskOutbox Task = "outbox"
const TaskSendCaptchaEmail Task = "sendCaptchaEmail"

email task

const TaskSendNotificationEmail Task = "sendNotificationEmail"
const TaskStatisticUpdate Task = "statisticUpdate"

transaction task

const TaskTransactionSync Task = "transactionSync"
const TaskTransactionTimingExec Task = "transactionTimingExec"
const TaskTransactionTimingTaskAssign Task = "transactionTimingTaskAssign"
const TaskUpdateCategoryMapping Task = "updateCategoryMapping"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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