27-02-21
This commit is contained in:
parent
6df3936a87
commit
b1588540ad
1 changed files with 11 additions and 14 deletions
17
main.go
17
main.go
|
@ -50,10 +50,6 @@ func main() {
|
||||||
connection, err := rabbitmq.Dial(conf.AMQPURL)
|
connection, err := rabbitmq.Dial(conf.AMQPURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("could not establish connection with RabbitMQ:" + err.Error())
|
panic("could not establish connection with RabbitMQ:" + err.Error())
|
||||||
}
|
|
||||||
consumeCh, err := connection.Channel()
|
|
||||||
if err != nil {
|
|
||||||
log.Panic(err)
|
|
||||||
}
|
}
|
||||||
publishCh, err := connection.Channel()
|
publishCh, err := connection.Channel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -61,8 +57,12 @@ func main() {
|
||||||
}
|
}
|
||||||
// Only if we allow TX, we process Messages
|
// Only if we allow TX, we process Messages
|
||||||
if conf.TXFreq != 0 {
|
if conf.TXFreq != 0 {
|
||||||
|
consumeCh, err := connection.Channel()
|
||||||
|
if err != nil {
|
||||||
|
log.Panic(err)
|
||||||
|
}
|
||||||
go func() {
|
go func() {
|
||||||
d, err := consumeCh.Consume("input", "", false, false, false, false, nil)
|
d, err := consumeCh.Consume("tx_pocsag", "", false, false, false, false, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panic(err)
|
log.Panic(err)
|
||||||
}
|
}
|
||||||
|
@ -71,11 +71,11 @@ func main() {
|
||||||
if msg.Headers["ric"] == nil { continue }
|
if msg.Headers["ric"] == nil { continue }
|
||||||
log.Printf("ric: %s", string(msg.Headers["ric"].(string)))
|
log.Printf("ric: %s", string(msg.Headers["ric"].(string)))
|
||||||
log.Printf("msg: %s", string(msg.Body))
|
log.Printf("msg: %s", string(msg.Body))
|
||||||
/*queueMessage(&pocsagencode.Message {
|
queueMessage(&pocsagencode.Message {
|
||||||
Addr: uint32(msg.Headers["ric"].(int)),
|
Addr: uint32(msg.Headers["ric"].(int)),
|
||||||
Content: string(msg.Body),
|
Content: string(msg.Body),
|
||||||
IsNumeric: (msg.Headers["numeric"] != nil),
|
IsNumeric: (msg.Headers["numeric"] != nil),
|
||||||
})*/
|
})
|
||||||
msg.Ack(true)
|
msg.Ack(true)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -157,9 +157,6 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
/*case byte := <-stream.ByteStream:
|
|
||||||
fmt.Printf("%x", byte)
|
|
||||||
break*/
|
|
||||||
case <-stream.Process:
|
case <-stream.Process:
|
||||||
data := make([]byte, len(stream.ByteStream))
|
data := make([]byte, len(stream.ByteStream))
|
||||||
//log.Println("--PROCESS=", len(stream.ByteStream), " bytes--")
|
//log.Println("--PROCESS=", len(stream.ByteStream), " bytes--")
|
||||||
|
|
Loading…
Add table
Reference in a new issue