event

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Created by guoxin in 2024/7/4 下午5:01

Index

Constants

View Source
const (
	ProcessStatusRecv  = "recv"
	ProcessStatusDone  = "done"
	ProcessStatusError = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractEventHandler

type ContractEventHandler struct {
	// contains filtered or unexported fields
}

ContractEventHandler 合约事件处理结构

func NewContractEvent

func NewContractEvent(
	ctx context.Context, client *sdk.ChainClient, redis commonredis.Interface, contractName string, topic string,
	processor Processor, topicLocker, currentBlockHeight, processStatus, processErrorSavior *cachekey.CacheKey,
	disconnectRetryInterval, processTimeout int64,
) *ContractEventHandler

NewContractEvent @Description: 基于长安链的分布式事件订阅 @param ctx 安全退出 @param client chainmaker 客户端 @param redis 缓存 @param contractName 订阅合约 @param topic 订阅主题 @param processor 处理事件实现 @param topicLocker 分布式锁 @param currentBlockHeight 当前区块高度 @param processStatus 事件处理状态 @param processErrorSavior 事件处理异常拯救者,保存异常数据到缓存 @param disconnectRetryInterval 订阅连接断开重试间隔 @return *ContractEventHandler

func (*ContractEventHandler) Subscribe

func (e *ContractEventHandler) Subscribe()

Subscribe @Description: 订阅方法重试策略 @receiver e

type ProcessFunc

type ProcessFunc = func(event *common.ContractEventInfo) error

type Processor

type Processor interface {
	Process(ctx context.Context, event *common.ContractEventInfo) error
}

Jump to

Keyboard shortcuts

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