mirror of
https://github.com/mainflux/mainflux.git
synced 2025-05-01 13:48:56 +08:00
Fix non-SenML message routing in normalizer (#573)
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
This commit is contained in:
parent
0fbb21c3fb
commit
8966a13760
@ -57,7 +57,7 @@ func (ps pubsub) publish(msg mainflux.RawMessage) error {
|
||||
output := mainflux.OutputSenML
|
||||
normalized, err := ps.svc.Normalize(msg)
|
||||
if err != nil {
|
||||
switch ct := normalized.ContentType; ct {
|
||||
switch ct := msg.ContentType; ct {
|
||||
case senML:
|
||||
return err
|
||||
case "":
|
||||
@ -65,6 +65,11 @@ func (ps pubsub) publish(msg mainflux.RawMessage) error {
|
||||
default:
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user