test
This commit is contained in:
parent
b98069f4ba
commit
c9e9dc397b
64
mq.go
64
mq.go
@ -37,38 +37,40 @@ func (s MQSession) Open() error {
|
||||
s.MQConnection.Close()
|
||||
return err
|
||||
}
|
||||
q, err = s.MQChannel.QueueDeclare(
|
||||
s.Queue, // name
|
||||
false, // durable
|
||||
false, // delete when unused
|
||||
false, // exclusive
|
||||
false, // no-wait
|
||||
nil, // arguments
|
||||
/*
|
||||
q, err = s.MQChannel.QueueDeclare(
|
||||
s.Queue, // name
|
||||
false, // durable
|
||||
false, // delete when unused
|
||||
false, // exclusive
|
||||
false, // no-wait
|
||||
nil, // arguments
|
||||
|
||||
)
|
||||
s.MQQueue = &q
|
||||
logOnError(err, "Open : Failed to declare queue")
|
||||
if err != nil {
|
||||
s.MQChannel.Close()
|
||||
s.MQConnection.Close()
|
||||
return err
|
||||
}
|
||||
s.MQDelivery, err = s.MQChannel.Consume(
|
||||
s.MQQueue.Name, // queue
|
||||
"", // consumer
|
||||
true, // auto-ack
|
||||
false, // exclusive
|
||||
false, // no-local
|
||||
false, // no-wait
|
||||
nil, // args
|
||||
)
|
||||
logOnError(err, "Open : Failed to register a consumer")
|
||||
if err != nil {
|
||||
s.MQChannel.Close()
|
||||
s.MQConnection.Close()
|
||||
return err
|
||||
}
|
||||
//log.Printf("Open : MQ Connected to amqp://" + s.User + ":" + s.Password + "@" + s.Host + "/" + s.Path)
|
||||
)
|
||||
s.MQQueue = &q
|
||||
logOnError(err, "Open : Failed to declare queue")
|
||||
if err != nil {
|
||||
s.MQChannel.Close()
|
||||
s.MQConnection.Close()
|
||||
return err
|
||||
}
|
||||
s.MQDelivery, err = s.MQChannel.Consume(
|
||||
s.MQQueue.Name, // queue
|
||||
"", // consumer
|
||||
true, // auto-ack
|
||||
false, // exclusive
|
||||
false, // no-local
|
||||
false, // no-wait
|
||||
nil, // args
|
||||
)
|
||||
logOnError(err, "Open : Failed to register a consumer")
|
||||
if err != nil {
|
||||
s.MQChannel.Close()
|
||||
s.MQConnection.Close()
|
||||
return err
|
||||
}
|
||||
//log.Printf("Open : MQ Connected to amqp://" + s.User + ":" + s.Password + "@" + s.Host + "/" + s.Path)
|
||||
*/
|
||||
s.isConnected = true
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user