1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-05-02 22:17:10 +08:00

Fix non-SenML message routing in normalizer (#573)

Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
This commit is contained in:
Aleksandar Novaković 2019-02-04 13:07:05 +01:00 committed by Nikola Marčetić
parent 0fbb21c3fb
commit 8966a13760

View File

@ -57,7 +57,7 @@ func (ps pubsub) publish(msg mainflux.RawMessage) error {
output := mainflux.OutputSenML output := mainflux.OutputSenML
normalized, err := ps.svc.Normalize(msg) normalized, err := ps.svc.Normalize(msg)
if err != nil { if err != nil {
switch ct := normalized.ContentType; ct { switch ct := msg.ContentType; ct {
case senML: case senML:
return err return err
case "": case "":
@ -65,6 +65,11 @@ func (ps pubsub) publish(msg mainflux.RawMessage) error {
default: default:
output = fmt.Sprintf("out.%s", ct) output = fmt.Sprintf("out.%s", ct)
} }
if err := ps.nc.Publish(output, msg.GetPayload()); err != nil {
ps.logger.Warn(fmt.Sprintf("Publishing failed: %s", err))
return err
}
} }
for _, v := range normalized.Messages { for _, v := range normalized.Messages {