samba/pkg/service/interface.go

37 lines
906 B
Go
Raw Normal View History

2025-06-04 09:51:39 +08:00
package service
import (
"github.com/rabbitmq/amqp091-go"
"time"
)
const (
serviceTypeSet = "-"
)
type IService interface {
Name() string
Type() string
ProcFuncOnce(cb HandlerFunc)
ExchangeDeclare(exchangeName, typ string) error
QueueDeclare(queueName string) error
QueueDelete(queueName string) error
QueueBind(queueName, routerKey, exchangeName string) error
QueueUnbind(queueName, routerKey, exchangeName string) error
Consume(queueName string) error
ConsumeDelete() error
Publish(exchangeName, routerKey string, msg []byte) error
PublishRpc(d *amqp091.Delivery, msg []byte) error
NewTimer(duration time.Duration, cb func(), needLog bool, desc ...string) uint32
CancelTimer(timerId uint32)
CancelAllTimer()
//Call(string, string, time.Duration, ...interface{}) ([]interface{}, error)
//pushMsg(*mq.Message) error
//pushRpcMsg(*mq.RpcMessage) error
WaitStop()
NotifyStop()
}