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.
36 lines
694 B
36 lines
694 B
2 months ago
|
package producers
|
||
|
|
||
|
import (
|
||
|
"github.com/streadway/amqp"
|
||
|
"matchmaking-system/internal/conf"
|
||
|
)
|
||
|
|
||
|
// Producer
|
||
|
// @Description:
|
||
|
type Producer struct {
|
||
|
Entrust *ProducerEntrust
|
||
|
Position *ProducerPosition
|
||
|
}
|
||
|
|
||
|
// NewProducer
|
||
|
//
|
||
|
// @Description: 初始化生产者
|
||
|
// @param f
|
||
|
// @param con
|
||
|
// @return *Producer
|
||
|
// @return error
|
||
|
func NewProducer(f *conf.Data, con *amqp.Connection) (*Producer, error) {
|
||
|
// 初始化生产者持仓消息队列
|
||
|
entrust, err := NewEntrust(f, con)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
// 初始化生产者平仓消息队列
|
||
|
position, err := NewPosition(f, con)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return &Producer{Entrust: entrust, Position: position}, nil
|
||
|
}
|