蛋蛋星球RabbitMq消费项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mq.go 1.1 KiB

1 month ago
1234567891011121314151617181920212223242526272829303132333435363738
  1. package md
  2. import "github.com/streadway/amqp"
  3. const (
  4. SimpleQueueType = "SimpleQueue"
  5. BroadQueueType = "BroadQueue"
  6. DirectQueueType = "DirectQueue"
  7. TopicQueueType = "TopicQueue"
  8. FanOutQueueType = "FanOutQueue"
  9. )
  10. type MsgClient struct {
  11. Conn *amqp.Connection
  12. Type string `json:"type"` //消息类型
  13. Data string `json:"data"` //队列数据
  14. }
  15. type SimpleQueue struct {
  16. RoutKey string `json:"rout_key"` //路由
  17. Queue string `json:"queue"` //队列的名字
  18. IsPersistent bool `json:"is_persistent"` //队列是否持久化
  19. }
  20. type ComplexQueue struct {
  21. ExchangeName string `json:"exchangeName"`
  22. RoutKey string `json:"rout_key"` //路由
  23. Queue string `json:"queue"` //队列的名字
  24. IsPersistent bool `json:"is_persistent"` //队列是否持久化
  25. }
  26. type TopicQueue struct {
  27. ExchangeName string `json:"exchangeName"`
  28. RoutKey string `json:"rout_key"` //路由
  29. Queue string `json:"queue"` //队列的名字
  30. IsPersistent bool `json:"is_persistent"` //队列是否持久化
  31. BindKey string `json:"bind_key"` //绑定的路由
  32. }