This commit is contained in:
parent
b2c9910856
commit
7bae3575d5
@ -8,12 +8,8 @@ import (
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var count uint64 = 0
|
||||
|
||||
func handle(msg *stomp.Message) {
|
||||
start := time.Now()
|
||||
count++
|
||||
log.Info("Message received", zap.Uint64("total since startup", count))
|
||||
schedule, err := unmarshalData(msg.Body)
|
||||
if err != nil {
|
||||
log.Error("Error unmarshalling VSTP Message", zap.Error(err))
|
||||
@ -28,6 +24,6 @@ func handle(msg *stomp.Message) {
|
||||
log.Error("Error processing VSTP Schedule", zap.Error(err))
|
||||
}
|
||||
end := time.Now()
|
||||
duration := start.Sub(end)
|
||||
duration := end.Sub(start)
|
||||
log.Info("Message processed", zap.Duration("processing-time", duration))
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package vstp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.fjla.uk/owlboard/timetable-mgr/log"
|
||||
@ -46,14 +45,13 @@ func Subscribe() {
|
||||
for {
|
||||
msg := <-sub.C
|
||||
if msg.Err != nil {
|
||||
log.Error("STOMP Message Error", zap.Error(msg.Err))
|
||||
log.Error("VSTP Message Error", zap.Error(msg.Err))
|
||||
} else {
|
||||
if msg != nil {
|
||||
log.Info("STOMP Message Received")
|
||||
fmt.Println(string(msg.Body))
|
||||
log.Info("VSTP Message Received")
|
||||
handle(msg)
|
||||
} else {
|
||||
log.Info("STOMP Message Empty")
|
||||
log.Info("VSTP Message Empty")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user