37 lines
906 B
Go
37 lines
906 B
Go
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()
|
|
}
|