Documentation ¶
Index ¶
- Constants
- func LogDebug(args ...interface{})
- func LogDebugf(format string, args ...interface{})
- func LogError(args ...interface{})
- func LogErrorf(format string, args ...interface{})
- func LogFatal(args ...interface{})
- func LogFatalf(format string, args ...interface{})
- func LogInfo(args ...interface{})
- func LogInfof(format string, args ...interface{})
- func LogWarn(args ...interface{})
- func LogWarnf(format string, args ...interface{})
- type BackendType
- type BrokerType
- type LockType
- type MessageCarrier
- type Server
- func (s *Server) Endpoint() (*url.URL, error)
- func (s *Server) HandleFunc(name string, handler interface{}) error
- func (s *Server) Name() string
- func (s *Server) NewChain(chainTasks ...TasksOption) error
- func (s *Server) NewChord(chordTasks ...TasksOption) error
- func (s *Server) NewGroup(groupTasks ...TasksOption) error
- func (s *Server) NewPeriodicChain(cronSpec string, chainTasks ...TasksOption) error
- func (s *Server) NewPeriodicChord(cronSpec string, chordTasks ...TasksOption) error
- func (s *Server) NewPeriodicGroup(cronSpec string, groupTasks ...TasksOption) error
- func (s *Server) NewPeriodicTask(cronSpec, typeName string, opts ...TaskOption) error
- func (s *Server) NewTask(typeName string, opts ...TaskOption) error
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(_ context.Context) error
- type ServerOption
- func WithAMQPConfig(cfg *config.AMQPConfig) ServerOption
- func WithBrokerAddress(addr string, db int, brokerType BrokerType) ServerOption
- func WithConsumerOption(consumerTag string, concurrency int, queue string) ServerOption
- func WithDefaultQueue(name string) ServerOption
- func WithDynamoDBConfig(cfg *config.DynamoDBConfig) ServerOption
- func WithEnableKeepAlive(enable bool) ServerOption
- func WithEnvironmentConfig() ServerOption
- func WithGCPPubSubConfig(cfg *config.GCPPubSubConfig) ServerOption
- func WithLockAddress(addr string, db, retries int, lockType LockType) ServerOption
- func WithMongoDBConfig(cfg *config.MongoDBConfig) ServerOption
- func WithNoUnixSignals(noUnixSignals bool) ServerOption
- func WithRedisConfig(cfg *config.RedisConfig) ServerOption
- func WithResultBackendAddress(addr string, db int, backendType BackendType) ServerOption
- func WithResultsExpireIn(expire int) ServerOption
- func WithSQSConfig(cfg *config.SQSConfig) ServerOption
- func WithTLSConfig(c *tls.Config) ServerOption
- func WithYamlConfig(cnfPath string, keepReloading bool) ServerOption
- type TaskOption
- func WithArgument(typeName string, value interface{}) TaskOption
- func WithDelayTime(delayTime time.Time) TaskOption
- func WithHeader(key string, value interface{}) TaskOption
- func WithHeaders(headers tasks.Headers) TaskOption
- func WithPriority(priority uint8) TaskOption
- func WithRetryCount(count int) TaskOption
- func WithRetryTimeout(timeout int) TaskOption
- func WithRoutingKey(key string) TaskOption
- type TasksOption
Constants ¶
View Source
const ( SignatureNameKey = attribute.Key("signature.name") SignatureUUIDKey = attribute.Key("signature.uuid") SignatureGroupUUIDKey = attribute.Key("signature.group.uuid") SignatureChordCallbackUUIDKey = attribute.Key("signature.chord.callback.uuid") SignatureChordCallbackNameKey = attribute.Key("signature.chord.callback.name") ChainTasksLengthKey = attribute.Key("chain.tasks.length") GroupUUIDKey = attribute.Key("group.uuid") GroupTasksLengthKey = attribute.Key("group.tasks.length") GroupConcurrencyKey = attribute.Key("group.concurrency") GroupTasksKey = attribute.Key("group.tasks") ChordCallbackUUIDKey = attribute.Key("chord.callback.uuid") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BackendType ¶
type BackendType int
const ( BackendTypeRedis BackendType = iota // Redis BackendTypeAmqp // AMQP BackendTypeMemcache // Memcache BackendTypeMongoDB // MongoDB BackendTypeDynamoDB // Amazon DynamoDB )
type BrokerType ¶
type BrokerType int
const ( BrokerTypeRedis BrokerType = iota // Redis BrokerTypeAmqp // AMQP BrokerTypeGcpPubSub // GCP Pub/Sub BrokerTypeSQS // AWS SQS )
type MessageCarrier ¶
type MessageCarrier struct {
// contains filtered or unexported fields
}
func NewMessageCarrier ¶
func NewMessageCarrier(msg *tasks.Headers) MessageCarrier
func (MessageCarrier) Get ¶
func (c MessageCarrier) Get(key string) string
func (MessageCarrier) Keys ¶
func (c MessageCarrier) Keys() []string
func (MessageCarrier) Set ¶
func (c MessageCarrier) Set(key, val string)
type Server ¶
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
func (*Server) HandleFunc ¶
func (*Server) NewChain ¶
func (s *Server) NewChain(chainTasks ...TasksOption) error
NewChain 执行一组同步任务,任务有次序之分,上个任务的出参可作为下个任务的入参。
func (*Server) NewChord ¶
func (s *Server) NewChord(chordTasks ...TasksOption) error
NewChord 先执行一组同步任务,执行完成后,再调用最后一个回调函数。
func (*Server) NewGroup ¶
func (s *Server) NewGroup(groupTasks ...TasksOption) error
NewGroup 执行一组异步任务,任务之间互不影响。
func (*Server) NewPeriodicChain ¶
func (s *Server) NewPeriodicChain(cronSpec string, chainTasks ...TasksOption) error
func (*Server) NewPeriodicChord ¶
func (s *Server) NewPeriodicChord(cronSpec string, chordTasks ...TasksOption) error
func (*Server) NewPeriodicGroup ¶
func (s *Server) NewPeriodicGroup(cronSpec string, groupTasks ...TasksOption) error
func (*Server) NewPeriodicTask ¶
func (s *Server) NewPeriodicTask(cronSpec, typeName string, opts ...TaskOption) error
NewPeriodicTask 周期性定时任务,不支持秒级任务,最大精度只到分钟。
type ServerOption ¶
type ServerOption func(o *Server)
func WithAMQPConfig ¶
func WithAMQPConfig(cfg *config.AMQPConfig) ServerOption
func WithBrokerAddress ¶
func WithBrokerAddress(addr string, db int, brokerType BrokerType) ServerOption
func WithConsumerOption ¶
func WithConsumerOption(consumerTag string, concurrency int, queue string) ServerOption
func WithDefaultQueue ¶
func WithDefaultQueue(name string) ServerOption
func WithDynamoDBConfig ¶
func WithDynamoDBConfig(cfg *config.DynamoDBConfig) ServerOption
func WithEnableKeepAlive ¶
func WithEnableKeepAlive(enable bool) ServerOption
WithEnableKeepAlive enable keep alive
func WithEnvironmentConfig ¶
func WithEnvironmentConfig() ServerOption
WithEnvironmentConfig read config from env.
func WithGCPPubSubConfig ¶
func WithGCPPubSubConfig(cfg *config.GCPPubSubConfig) ServerOption
func WithLockAddress ¶
func WithLockAddress(addr string, db, retries int, lockType LockType) ServerOption
func WithMongoDBConfig ¶
func WithMongoDBConfig(cfg *config.MongoDBConfig) ServerOption
func WithNoUnixSignals ¶
func WithNoUnixSignals(noUnixSignals bool) ServerOption
func WithRedisConfig ¶
func WithRedisConfig(cfg *config.RedisConfig) ServerOption
func WithResultBackendAddress ¶
func WithResultBackendAddress(addr string, db int, backendType BackendType) ServerOption
func WithResultsExpireIn ¶
func WithResultsExpireIn(expire int) ServerOption
func WithSQSConfig ¶
func WithSQSConfig(cfg *config.SQSConfig) ServerOption
func WithTLSConfig ¶
func WithTLSConfig(c *tls.Config) ServerOption
func WithYamlConfig ¶
func WithYamlConfig(cnfPath string, keepReloading bool) ServerOption
WithYamlConfig read config from yaml file.
type TaskOption ¶
func WithArgument ¶
func WithArgument(typeName string, value interface{}) TaskOption
func WithDelayTime ¶
func WithDelayTime(delayTime time.Time) TaskOption
func WithHeader ¶
func WithHeader(key string, value interface{}) TaskOption
func WithHeaders ¶
func WithHeaders(headers tasks.Headers) TaskOption
func WithPriority ¶
func WithPriority(priority uint8) TaskOption
func WithRetryCount ¶
func WithRetryCount(count int) TaskOption
func WithRetryTimeout ¶
func WithRetryTimeout(timeout int) TaskOption
func WithRoutingKey ¶
func WithRoutingKey(key string) TaskOption
type TasksOption ¶
func WithTask ¶
func WithTask(typeName string, opts ...TaskOption) TasksOption
Click to show internal directories.
Click to hide internal directories.