Mainflux.mainflux/lora/events/streams.go

197 lines
4.3 KiB
Go
Raw Permalink Normal View History

MF-1506 - Group-based Access Control (#1716) * Move Things and Users to Clients Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * NOISSUE - Update Add and Delete Policies (#1792) * Remove Policy Action Ranks Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Rebase Issues Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix CI Test Errors Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Adding Check on Subject For Clients Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Remove Check Client Exists Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Check When Sharing Clients Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Only Add User to Group When Sharing Things Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Remove clientType Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Minor Fix on ShareClient and Fix Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Policies Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Clean Up Things Authorization Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Tests on RetrieveAll Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Test ShareThing Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Merge Conflicts Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Remove Adding Policies. Only Use Ownership Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Check If Subject is same as Object Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Move Back To Union As Sometimes Policy is Empty and Fails to Evaluate on Ownership Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Entity Type For Failing Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix BUG in policy evaluation Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Comments Regarding checkAdmin Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Tests On Rebase Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Combine Authorize For Things and Users Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Tests On Rebase Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Error on Things SVC `unsupported protocol scheme` Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Fix Bug on Things Authorization Cache (#1810) Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Use Password instead of username in MQTT handler Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Simplify MQTT authorization Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Fix MQTT tests Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * NOISSUE - Add More Functions to SDK (#1811) * Add More Functions to SDK Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Examples to GoDoc Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Update Unassign Interface Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Pass Subject as ID and Not Token on List Channels By Thing Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Bootstrap Errors For Element Check Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add empty line Before Return Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Reorder URLS in things mux Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Listing Things Policies Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Share Thing Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Examples to CLI Docs Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Update Identity To Update Another User Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Identify an Update Policies on Things Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Update Things Policies Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix GoDocs on Disconnect Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Change Authorize To Use AccessRequest Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * For Evaluate Policy Use AccessRequest (#1814) Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * NOISSUE - Add SDK Tests (#1812) * Add Things Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Channel Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Certs Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Consumer Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Enrich Group Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Tests For Health Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Tests For Tokens Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Rename SDK for Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Policies Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Linter Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Make Variable Defination Inline Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * NOISSUE - Make Cache Key Duration Configurable (#1815) * Make Cache Key Duration Configurable Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Rename ENV Var Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * NOISSUE - Update GoDocs (#1816) * Add GoDocs Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Missing GoDoc Files Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Enable godot Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add License Information Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * NOISSUE - Add Call Home Client to Mainflux services (#1751) * Move Things and Users to Clients Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: SammyOina <sammyoina@gmail.com> * collect and send data package Signed-off-by: SammyOina <sammyoina@gmail.com> * create telemetry migrations Signed-off-by: SammyOina <sammyoina@gmail.com> * add telemetry endpoints Signed-off-by: SammyOina <sammyoina@gmail.com> * add transport Signed-off-by: SammyOina <sammyoina@gmail.com> * create service Signed-off-by: SammyOina <sammyoina@gmail.com> * remove homing server Signed-off-by: SammyOina <sammyoina@gmail.com> * add call home to adapters Signed-off-by: SammyOina <sammyoina@gmail.com> * add last seen Signed-off-by: SammyOina <sammyoina@gmail.com> * rename logger Signed-off-by: SammyOina <sammyoina@gmail.com> * remove homing client Signed-off-by: SammyOina <sammyoina@gmail.com> * use unmerged repo Signed-off-by: SammyOina <sammyoina@gmail.com> * use renamed module Signed-off-by: SammyOina <sammyoina@gmail.com> * update call home version Signed-off-by: SammyOina <sammyoina@gmail.com> * edit documentation Signed-off-by: SammyOina <sammyoina@gmail.com> * align table Signed-off-by: SammyOina <sammyoina@gmail.com> * use alias for call home client Signed-off-by: SammyOina <sammyoina@gmail.com> * update callhome Signed-off-by: SammyOina <sammyoina@gmail.com> * update call home pkg Signed-off-by: SammyOina <sammyoina@gmail.com> * update call home Signed-off-by: SammyOina <sammyoina@gmail.com> * fix modules Signed-off-by: SammyOina <sammyoina@gmail.com> * use mf build version Signed-off-by: SammyOina <sammyoina@gmail.com> * use mf build version Signed-off-by: SammyOina <sammyoina@gmail.com> * restore default Signed-off-by: SammyOina <sammyoina@gmail.com> * add call home for users and things Signed-off-by: SammyOina <sammyoina@gmail.com> * enable opting on call home Signed-off-by: SammyOina <sammyoina@gmail.com> * remove full stops Signed-off-by: SammyOina <sammyoina@gmail.com> * update callhome client Signed-off-by: SammyOina <sammyoina@gmail.com> * add call home to all services Signed-off-by: SammyOina <sammyoina@gmail.com> * fix build Signed-off-by: SammyOina <sammyoina@gmail.com> * restore sdk tests Signed-off-by: SammyOina <sammyoina@gmail.com> * remove unnecessary changes Signed-off-by: SammyOina <sammyoina@gmail.com> * restore health_test.go Signed-off-by: SammyOina <sammyoina@gmail.com> --------- Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: SammyOina <sammyoina@gmail.com> Co-authored-by: b1ackd0t <blackd0t@protonmail.com> Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> --------- Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Signed-off-by: SammyOina <sammyoina@gmail.com> Co-authored-by: b1ackd0t <blackd0t@protonmail.com> Co-authored-by: Sammy Kerata Oina <44265300+SammyOina@users.noreply.github.com>
2023-06-14 18:40:37 +08:00
// Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
package events
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
import (
"context"
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
"encoding/json"
"errors"
"github.com/mainflux/mainflux/lora"
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
"github.com/mainflux/mainflux/pkg/events"
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
)
const (
keyType = "lora"
keyDevEUI = "dev_eui"
keyAppID = "app_id"
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
thingPrefix = "thing."
thingCreate = thingPrefix + "create"
thingUpdate = thingPrefix + "update"
thingRemove = thingPrefix + "remove"
thingConnect = thingPrefix + "connect"
thingDisconnect = thingPrefix + "disconnect"
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
channelPrefix = "channel."
channelCreate = channelPrefix + "create"
channelUpdate = channelPrefix + "update"
channelRemove = channelPrefix + "remove"
)
var (
errMetadataType = errors.New("field lora is missing in the metadata")
errMetadataFormat = errors.New("malformed metadata")
errMetadataAppID = errors.New("application ID not found in channel metadatada")
errMetadataDevEUI = errors.New("device EUI not found in thing metadatada")
)
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
type eventHandler struct {
svc lora.Service
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
// NewEventHandler returns new event store handler.
func NewEventHandler(svc lora.Service) events.EventHandler {
return &eventHandler{
svc: svc,
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
}
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
func (es *eventHandler) Handle(ctx context.Context, event events.Event) error {
msg, err := event.Encode()
if err != nil {
return err
}
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
switch msg["operation"] {
case thingCreate:
cte, derr := decodeCreateThing(msg)
if derr != nil {
err = derr
break
}
err = es.svc.CreateThing(ctx, cte.id, cte.loraDevEUI)
case thingUpdate:
ute, derr := decodeCreateThing(msg)
if derr != nil {
err = derr
break
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
err = es.svc.CreateThing(ctx, ute.id, ute.loraDevEUI)
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
case channelCreate:
cce, derr := decodeCreateChannel(msg)
if derr != nil {
err = derr
break
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
err = es.svc.CreateChannel(ctx, cce.id, cce.loraAppID)
case channelUpdate:
uce, derr := decodeCreateChannel(msg)
if derr != nil {
err = derr
break
}
err = es.svc.CreateChannel(ctx, uce.id, uce.loraAppID)
case thingRemove:
rte := decodeRemoveThing(msg)
err = es.svc.RemoveThing(ctx, rte.id)
case channelRemove:
rce := decodeRemoveChannel(msg)
err = es.svc.RemoveChannel(ctx, rce.id)
case thingConnect:
tce := decodeConnectionThing(msg)
err = es.svc.ConnectThing(ctx, tce.chanID, tce.thingID)
case thingDisconnect:
tde := decodeConnectionThing(msg)
err = es.svc.DisconnectThing(ctx, tde.chanID, tde.thingID)
}
if err != nil && err != errMetadataType {
return err
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
NOISSUE - Add Event Sourcing Package (#1897) * Add event sourcing package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move producer to es package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Change the redis subscriber interface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Clean up publisher inaterface Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Update redis version Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Add tests Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename factory functions of events store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Rename redis package to events package Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove unnecessary alias on redis event store Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Minor cosmetic changes Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove stream length from factory function Set the default stream length to 1e9 in the events package. This is because the stream length is not a required parameter in the factory function. This commit also removes the stream length from the factory function. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Remove group Name on subscribing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor package consumer to reflect changes in service name The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Refactor main to remove go routines Remove go routines from main when subscribing to events. This is because the event handlers are already running in their own go routines. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Move cache to seperate package This commit moves the cache package to a seperate package. This is because the cache package is not the same as events package. The cache package is used to store the data in memory while the events package is used to send events to the event bus. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> * Make startPublishingRoutine private Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 18:12:17 +08:00
return nil
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
func decodeCreateThing(event map[string]interface{}) (createThingEvent, error) {
strmeta := read(event, "metadata", "{}")
var metadata map[string]interface{}
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
if err := json.Unmarshal([]byte(strmeta), &metadata); err != nil {
return createThingEvent{}, err
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
cte := createThingEvent{
id: read(event, "id", ""),
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
}
m, ok := metadata[keyType]
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
if !ok {
return createThingEvent{}, errMetadataType
}
lm, ok := m.(map[string]interface{})
if !ok {
return createThingEvent{}, errMetadataFormat
}
val, ok := lm[keyDevEUI].(string)
if !ok {
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
return createThingEvent{}, errMetadataDevEUI
}
cte.loraDevEUI = val
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
return cte, nil
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
func decodeRemoveThing(event map[string]interface{}) removeThingEvent {
return removeThingEvent{
id: read(event, "id", ""),
}
}
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
func decodeCreateChannel(event map[string]interface{}) (createChannelEvent, error) {
strmeta := read(event, "metadata", "{}")
var metadata map[string]interface{}
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
if err := json.Unmarshal([]byte(strmeta), &metadata); err != nil {
return createChannelEvent{}, err
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
cce := createChannelEvent{
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
id: read(event, "id", ""),
}
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
m, ok := metadata[keyType]
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
if !ok {
return createChannelEvent{}, errMetadataType
}
lm, ok := m.(map[string]interface{})
if !ok {
return createChannelEvent{}, errMetadataFormat
}
val, ok := lm[keyAppID].(string)
if !ok {
return createChannelEvent{}, errMetadataAppID
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
cce.loraAppID = val
return cce, nil
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
func decodeConnectionThing(event map[string]interface{}) connectionThingEvent {
return connectionThingEvent{
chanID: read(event, "chan_id", ""),
thingID: read(event, "thing_id", ""),
}
}
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
func decodeRemoveChannel(event map[string]interface{}) removeChannelEvent {
return removeChannelEvent{
id: read(event, "id", ""),
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
}
MF-549 - Change metadata format from JSON string to JSON object (#706) * Update metadata type in things service Update things service so that metadata has map type. Update repo implementation by adding sqlx lib. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add sqlx lib to bootstrap service Add sqlx lib to bootstrap service and update metadata field type. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update metadata in redis streams consumer Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update tests for bootstrap service Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader logging and driver version Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix mongo reader and writer Fix mongo reader and writer by updating driver version. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update SDK with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update LoRa adapter with new metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update users service in order to use sqlx Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Replace anonymous struct with map Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update docs for LoRa adapter Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix LoRa application metadata format Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix metadata format in LoRa docs Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add metadata2 var to SDK things test Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
2019-04-16 20:58:56 +08:00
}
MF-166 - Add lora-adapter service (#481) * MF-166 - Add lora-adapter service (#416) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * MF-166 - Add lora-adapter service (#461) * MF-166 - Add lora-adapter service Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix NATS connexion and use credentials with gRPC Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Forward lora msgs to nats Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add make cmd and docker-compose Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Define lora conf as private Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename funcs fix nats conn Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README and fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm NATS sub Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix lora server topic and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix HTTP port Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * NOISSUE - Add event sourcing client to LoRa adapter (#471) * Add event sourcing client to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Update redis version in docker compose and update env vars Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add ES subscription to main LoRa function Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add new env vars to readme file of LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add message acknowledgement to LoRa adapter Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add handling of empty values to event sourcing client (#474) Signed-off-by: Aleksandar Novaković <anovakovic01@gmail.com> * Add routemap and handle event sourcing Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix eventStore decoding Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv docker-compose in docker/addons Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix routemap and logs Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update Gopkg.toml Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix route map and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Update README Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2018-12-05 03:08:30 +08:00
func read(event map[string]interface{}, key, def string) string {
val, ok := event[key].(string)
if !ok {
return def
}
return val
}