forked from go-admin-team/go-admin-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
amqp.go
28 lines (23 loc) · 842 Bytes
/
amqp.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package runtime
import (
"github.com/xuanlingzi/go-admin-core/message"
)
type Amqp struct {
prefix string
amqp message.AdapterAmqp
}
// String string输出
func (e *Amqp) String() string {
if e.amqp == nil {
return ""
}
return e.amqp.String()
}
// PublishOnQueue 发送消息
func (e *Amqp) PublishOnQueue(exchangeName, exchangeType, queueName, key, tag string, durableQueue bool, body interface{}) error {
return e.amqp.PublishOnQueue(exchangeName, exchangeType, queueName, key, tag, durableQueue, body)
}
// SubscribeToQueue 消费消息
func (e *Amqp) SubscribeToQueue(exchangeName, exchangeType, queueName, key, tag string, durableQueue bool, consumerExclusive bool, f message.AmqpConsumerFunc) error {
return e.amqp.SubscribeToQueue(exchangeName, exchangeType, queueName, key, tag, durableQueue, consumerExclusive, f)
}