| 123456789101112131415161718 |
- package Provider
- import "github.com/streadway/amqp"
- type Provider interface {
- MsgContent() string
- }
- func provide(channel *amqp.Channel, queue *amqp.Queue, msg string) error {
- //publishing为要发布的信息
- //Publishing的DeliveryMode如果设为amqp.Persistent则消息会持久化
- publishing := amqp.Publishing {
- ContentType: "text/plain",
- Body: []byte(msg),
- }
- return channel.Publish("", queue.Name,false,false, publishing)
- }
|