Documentation ¶
Index ¶
- Constants
- func BrokerTopicKey(topicPrefix string, appID string, topicID string) string
- func KeyDSN(addr, userName, password, dataBase, charset string) string
- func KeyProducerConf(appID, topicID string) string
- type CbCfType
- type DB
- type Event
- func (s *Event) Commit(ctx context.Context, req interface{}) (interface{}, error)
- func (s *Event) InternalHandler(ctx context.Context, req interface{}) (interface{}, error)
- func (s *Event) Prepare(ctx context.Context, req interface{}) (interface{}, error)
- func (s *Event) Report(ctx context.Context, req interface{}) (interface{}, error)
- func (s *Event) Rollback(ctx context.Context, req interface{}) (interface{}, error)
- func (s *Event) Stop() error
- type GormLogger
- func (GormLogger) Error(ctx context.Context, s string, i ...interface{})
- func (GormLogger) Info(ctx context.Context, s string, i ...interface{})
- func (GormLogger) LogMode(level logger.LogLevel) logger.Interface
- func (GormLogger) Trace(ctx context.Context, begin time.Time, ...)
- func (GormLogger) Warn(ctx context.Context, s string, i ...interface{})
- type Handler
- type Transaction
- func (s *Transaction) AsyncReportEvent(args interface{})
- func (s *Transaction) CallBack(ctx context.Context, req interface{}) (interface{}, error)
- func (s *Transaction) CallBackInternal(ctx context.Context, msg *define.TxEventMsg) error
- func (s *Transaction) Commit(ctx context.Context, req *define.CommitReq) (*comm.Tx, error)
- func (s *Transaction) Prepare(ctx context.Context, req *define.PrepareReq) (string, error)
- func (s *Transaction) Rollback(ctx context.Context, req *define.RollbackReq) (*comm.Tx, error)
- func (s *Transaction) Run() error
- func (s *Transaction) SendCallBackDelayMsg(msg *define.TxEventMsg)
- func (s *Transaction) SetProducerConfList(confInfoList []*cc.ProducerConfInfo)
- func (s *Transaction) Stop() error
- func (s *Transaction) WatchProducerConf(c *cc.ProducerConfInfo, eventType int32) error
Constants ¶
const ( // TxStatusRunning TxStatus TxStatusRunning comm.TxStatus = 0 // TxStatusPrepare TxStatusPrepare comm.TxStatus = 1 // TxStatusCommit TxStatusCommit comm.TxStatus = 2 // TxStatusRollback TxStatusRollback comm.TxStatus = 3 // TxStatusSuccess TxStatusSuccess comm.TxStatus = 4 // RetryCount is the number of times RetryCount = 20 // AsyncReportEvent AsyncReportEvent = 0 // AsyncCallBack AsyncCallBack = 1 // CbHeartbeatTimeOut CbHeartbeatTimeOut = 60 // CfHeartbeatTimeOut CfHeartbeatTimeOut = 60 // CbExpire CbExpire = -60 * 5 // TimeStrFormat TimeStrFormat = "2006-01-02 15:04:05" // PeriodLimit PeriodLimit = 10 // CbCfTypeConfigParam CbCfTypeConfigParam CbCfType = 1 // CbCfTypeConfigPlatform CbCfTypeConfigPlatform CbCfType = 2 // CbCfTypeConfig DefaultCbTimeout = 5000 // DefaultCbInterval DefaultCbInterval = 1000 * 60 * 2 )
const (
DSNKey = "%v:%v@tcp(%v)/%v?charset=%v&parseTime=True&loc=Local"
)
const (
KeyBrokerTopic = "%v%v_%v"
)
Variables ¶
This section is empty.
Functions ¶
func BrokerTopicKey ¶
BrokerTopicKey returns the broker topic
func KeyProducerConf ¶
KeyProducerConf returns the key of producer group
Types ¶
type DB ¶
type DB struct { // Engine is the name of the database Engine *gorm.DB // contains filtered or unexported fields }
DB is type of store
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event include loops, delays, transactions, and real-time events
func (*Event) InternalHandler ¶
InternalHandler is used to handle internal messages
type Handler ¶
type Handler struct { // DelayConnector is the name of the delay connector DelayConnector connector.Connector // RealTimeConnector is the name of the real time connector RealTimeConnector connector.Connector // BizNO is the name of the biz number BizNO bizno.Pool }
Handler is the handler for events
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction is a way of handling an event
func NewTransaction ¶
func NewTransaction(txConfig *options.TransactionConfig, handler *Handler, confInfoList []*cc.ProducerConfInfo) (*Transaction, error)
NewTransaction creates a new transaction
func (*Transaction) AsyncReportEvent ¶
func (s *Transaction) AsyncReportEvent(args interface{})
AsyncReportEvent is used to report events
func (*Transaction) CallBack ¶
func (s *Transaction) CallBack(ctx context.Context, req interface{}) (interface{}, error)
CallBack is used to call back
func (*Transaction) CallBackInternal ¶
func (s *Transaction) CallBackInternal(ctx context.Context, msg *define.TxEventMsg) error
CallBackInternal
func (*Transaction) Prepare ¶
func (s *Transaction) Prepare(ctx context.Context, req *define.PrepareReq) (string, error)
Prepare is used to prepare a transaction
func (*Transaction) Rollback ¶
func (s *Transaction) Rollback(ctx context.Context, req *define.RollbackReq) (*comm.Tx, error)
Rollback is used rollback the transaction
func (*Transaction) SendCallBackDelayMsg ¶
func (s *Transaction) SendCallBackDelayMsg(msg *define.TxEventMsg)
SendCallBackDelayMsg is used to send a delay message
func (*Transaction) SetProducerConfList ¶
func (s *Transaction) SetProducerConfList(confInfoList []*cc.ProducerConfInfo)
SetProducerConfList is used to set the list of producers
func (*Transaction) Stop ¶
func (s *Transaction) Stop() error
Stop stops the transaction gracefully.
func (*Transaction) WatchProducerConf ¶
func (s *Transaction) WatchProducerConf(c *cc.ProducerConfInfo, eventType int32) error
WatchProducerConf is used to watch producer configuration