timetable-mgr/vstp/handler.go
Fred Boniface 790d293bc4
All checks were successful
Go Test / test (push) Successful in 2m4s
Update STOMP disconnection
2024-04-15 20:37:04 +01:00

29 lines
657 B
Go

package vstp
import (
"time"
"git.fjla.uk/owlboard/timetable-mgr/log"
"github.com/go-stomp/stomp/v3"
"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(string(msg.Body))
if err != nil {
log.Error("Error unmarshalling VSTP Message", zap.Error(err))
}
err = processCifData(schedule)
if err != nil {
log.Error("Error processing VSTP Schedule", zap.Error(err))
}
end := time.Now()
duration := start.Sub(end)
log.Info("Message processed", zap.Duration("processing-time", duration))
}