2020-01-10 17:25:36 +01:00
|
|
|
// Copyright (c) Mainflux
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
package twins
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
2020-03-18 19:56:39 +01:00
|
|
|
"math"
|
2020-01-10 17:25:36 +01:00
|
|
|
"time"
|
|
|
|
|
2023-08-11 02:30:25 -07:00
|
|
|
"github.com/mainflux/mainflux"
|
2020-04-01 21:22:13 +02:00
|
|
|
"github.com/mainflux/mainflux/logger"
|
2020-06-03 15:16:19 +02:00
|
|
|
"github.com/mainflux/mainflux/pkg/errors"
|
|
|
|
"github.com/mainflux/mainflux/pkg/messaging"
|
2023-06-14 12:40:37 +02:00
|
|
|
"github.com/mainflux/mainflux/users/policies"
|
2020-01-10 17:25:36 +01:00
|
|
|
"github.com/mainflux/senml"
|
|
|
|
)
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
const publisher = "twins"
|
2020-04-01 21:22:13 +02:00
|
|
|
|
2020-01-10 17:25:36 +01:00
|
|
|
// Service specifies an API that must be fullfiled by the domain service
|
|
|
|
// implementation, and all of its decorators (e.g. logging & metrics).
|
|
|
|
type Service interface {
|
|
|
|
// AddTwin adds new twin related to user identified by the provided key.
|
2020-04-05 13:15:47 +02:00
|
|
|
AddTwin(ctx context.Context, token string, twin Twin, def Definition) (tw Twin, err error)
|
2020-01-10 17:25:36 +01:00
|
|
|
|
|
|
|
// UpdateTwin updates twin identified by the provided Twin that
|
|
|
|
// belongs to the user identified by the provided key.
|
2020-04-05 13:15:47 +02:00
|
|
|
UpdateTwin(ctx context.Context, token string, twin Twin, def Definition) (err error)
|
2020-01-10 17:25:36 +01:00
|
|
|
|
|
|
|
// ViewTwin retrieves data about twin with the provided
|
|
|
|
// ID belonging to the user identified by the provided key.
|
2020-06-05 11:42:16 +02:00
|
|
|
ViewTwin(ctx context.Context, token, twinID string) (tw Twin, err error)
|
2020-04-05 13:15:47 +02:00
|
|
|
|
|
|
|
// RemoveTwin removes the twin identified with the provided ID, that
|
|
|
|
// belongs to the user identified by the provided key.
|
2020-06-05 11:42:16 +02:00
|
|
|
RemoveTwin(ctx context.Context, token, twinID string) (err error)
|
2020-01-10 17:25:36 +01:00
|
|
|
|
|
|
|
// ListTwins retrieves data about subset of twins that belongs to the
|
|
|
|
// user identified by the provided key.
|
2020-04-21 17:05:19 +02:00
|
|
|
ListTwins(ctx context.Context, token string, offset uint64, limit uint64, name string, metadata Metadata) (Page, error)
|
2020-01-10 17:25:36 +01:00
|
|
|
|
|
|
|
// ListStates retrieves data about subset of states that belongs to the
|
|
|
|
// twin identified by the id.
|
2020-06-05 11:42:16 +02:00
|
|
|
ListStates(ctx context.Context, token string, offset uint64, limit uint64, twinID string) (StatesPage, error)
|
2020-01-10 17:25:36 +01:00
|
|
|
|
2020-02-04 23:25:51 +01:00
|
|
|
// SaveStates persists states into database
|
2023-07-06 20:57:51 +03:00
|
|
|
SaveStates(ctx context.Context, msg *messaging.Message) error
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-03-18 19:56:39 +01:00
|
|
|
const (
|
|
|
|
noop = iota
|
|
|
|
update
|
|
|
|
save
|
2020-07-09 12:18:19 +02:00
|
|
|
millisec = 1e6
|
|
|
|
nanosec = 1e9
|
|
|
|
SubtopicWildcard = ">"
|
2020-03-18 19:56:39 +01:00
|
|
|
)
|
|
|
|
|
2020-01-10 17:25:36 +01:00
|
|
|
var crudOp = map[string]string{
|
2020-02-20 00:10:10 +01:00
|
|
|
"createSucc": "create.success",
|
|
|
|
"createFail": "create.failure",
|
|
|
|
"updateSucc": "update.success",
|
|
|
|
"updateFail": "update.failure",
|
|
|
|
"getSucc": "get.success",
|
|
|
|
"getFail": "get.failure",
|
|
|
|
"removeSucc": "remove.success",
|
|
|
|
"removeFail": "remove.failure",
|
|
|
|
"stateSucc": "save.success",
|
|
|
|
"stateFail": "save.failure",
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type twinsService struct {
|
2021-01-17 23:12:45 +01:00
|
|
|
publisher messaging.Publisher
|
2023-06-14 12:40:37 +02:00
|
|
|
auth policies.AuthServiceClient
|
2021-01-17 23:12:45 +01:00
|
|
|
twins TwinRepository
|
|
|
|
states StateRepository
|
|
|
|
idProvider mainflux.IDProvider
|
|
|
|
channelID string
|
|
|
|
twinCache TwinCache
|
|
|
|
logger logger.Logger
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var _ Service = (*twinsService)(nil)
|
|
|
|
|
|
|
|
// New instantiates the twins service implementation.
|
2023-06-14 12:40:37 +02:00
|
|
|
func New(publisher messaging.Publisher, auth policies.AuthServiceClient, twins TwinRepository, tcache TwinCache, sr StateRepository, idp mainflux.IDProvider, chann string, logger logger.Logger) Service {
|
2020-01-10 17:25:36 +01:00
|
|
|
return &twinsService{
|
2021-01-17 23:12:45 +01:00
|
|
|
publisher: publisher,
|
|
|
|
auth: auth,
|
|
|
|
twins: twins,
|
|
|
|
twinCache: tcache,
|
|
|
|
states: sr,
|
|
|
|
idProvider: idp,
|
|
|
|
channelID: chann,
|
|
|
|
logger: logger,
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ts *twinsService) AddTwin(ctx context.Context, token string, twin Twin, def Definition) (tw Twin, err error) {
|
|
|
|
var id string
|
|
|
|
var b []byte
|
2023-04-20 22:39:33 +03:00
|
|
|
defer ts.publish(ctx, &id, &err, crudOp["createSucc"], crudOp["createFail"], &b)
|
2020-01-10 17:25:36 +01:00
|
|
|
|
2023-07-28 15:39:13 +03:00
|
|
|
res, err := ts.auth.Identify(ctx, &policies.IdentifyReq{Token: token})
|
2020-01-10 17:25:36 +01:00
|
|
|
if err != nil {
|
2022-01-27 17:03:57 +01:00
|
|
|
return Twin{}, err
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2021-01-17 23:12:45 +01:00
|
|
|
twin.ID, err = ts.idProvider.ID()
|
2020-01-10 17:25:36 +01:00
|
|
|
if err != nil {
|
|
|
|
return Twin{}, err
|
|
|
|
}
|
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
twin.Owner = res.GetId()
|
2020-01-10 17:25:36 +01:00
|
|
|
|
2020-05-18 18:46:50 +02:00
|
|
|
t := time.Now()
|
|
|
|
twin.Created = t
|
|
|
|
twin.Updated = t
|
2020-01-10 17:25:36 +01:00
|
|
|
|
2020-03-18 19:56:39 +01:00
|
|
|
if def.Attributes == nil {
|
2020-02-04 23:25:51 +01:00
|
|
|
def.Attributes = []Attribute{}
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
2020-03-18 19:56:39 +01:00
|
|
|
if def.Delta == 0 {
|
|
|
|
def.Delta = millisec
|
|
|
|
}
|
|
|
|
|
2020-01-10 17:25:36 +01:00
|
|
|
def.Created = time.Now()
|
|
|
|
def.ID = 0
|
|
|
|
twin.Definitions = append(twin.Definitions, def)
|
|
|
|
|
|
|
|
twin.Revision = 0
|
|
|
|
if _, err = ts.twins.Save(ctx, twin); err != nil {
|
|
|
|
return Twin{}, err
|
|
|
|
}
|
|
|
|
|
|
|
|
id = twin.ID
|
|
|
|
b, err = json.Marshal(twin)
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
return twin, ts.twinCache.Save(ctx, twin)
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (ts *twinsService) UpdateTwin(ctx context.Context, token string, twin Twin, def Definition) (err error) {
|
|
|
|
var b []byte
|
|
|
|
var id string
|
2023-04-20 22:39:33 +03:00
|
|
|
defer ts.publish(ctx, &id, &err, crudOp["updateSucc"], crudOp["updateFail"], &b)
|
2020-01-10 17:25:36 +01:00
|
|
|
|
2023-07-28 15:39:13 +03:00
|
|
|
_, err = ts.auth.Identify(ctx, &policies.IdentifyReq{Token: token})
|
2020-01-10 17:25:36 +01:00
|
|
|
if err != nil {
|
2022-02-01 17:33:23 +01:00
|
|
|
return errors.ErrAuthentication
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
tw, err := ts.twins.RetrieveByID(ctx, twin.ID)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2020-01-22 15:58:24 +01:00
|
|
|
|
|
|
|
revision := false
|
2020-01-10 17:25:36 +01:00
|
|
|
|
|
|
|
if twin.Name != "" {
|
2020-01-22 15:58:24 +01:00
|
|
|
revision = true
|
2020-01-10 17:25:36 +01:00
|
|
|
tw.Name = twin.Name
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(def.Attributes) > 0 {
|
2020-01-22 15:58:24 +01:00
|
|
|
revision = true
|
2020-01-10 17:25:36 +01:00
|
|
|
def.Created = time.Now()
|
|
|
|
def.ID = tw.Definitions[len(tw.Definitions)-1].ID + 1
|
|
|
|
tw.Definitions = append(tw.Definitions, def)
|
|
|
|
}
|
|
|
|
|
2020-01-22 15:58:24 +01:00
|
|
|
if len(twin.Metadata) > 0 {
|
|
|
|
revision = true
|
2020-01-10 17:25:36 +01:00
|
|
|
tw.Metadata = twin.Metadata
|
|
|
|
}
|
|
|
|
|
2020-01-22 15:58:24 +01:00
|
|
|
if !revision {
|
2022-01-27 17:03:57 +01:00
|
|
|
return errors.ErrMalformedEntity
|
2020-01-22 15:58:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
tw.Updated = time.Now()
|
|
|
|
tw.Revision++
|
|
|
|
|
2020-01-10 17:25:36 +01:00
|
|
|
if err := ts.twins.Update(ctx, tw); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
id = twin.ID
|
|
|
|
b, err = json.Marshal(tw)
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
return ts.twinCache.Update(ctx, twin)
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
func (ts *twinsService) ViewTwin(ctx context.Context, token, twinID string) (tw Twin, err error) {
|
2020-01-10 17:25:36 +01:00
|
|
|
var b []byte
|
2023-04-20 22:39:33 +03:00
|
|
|
defer ts.publish(ctx, &twinID, &err, crudOp["getSucc"], crudOp["getFail"], &b)
|
2020-01-10 17:25:36 +01:00
|
|
|
|
2023-07-28 15:39:13 +03:00
|
|
|
_, err = ts.auth.Identify(ctx, &policies.IdentifyReq{Token: token})
|
2020-01-10 17:25:36 +01:00
|
|
|
if err != nil {
|
2022-01-27 17:03:57 +01:00
|
|
|
return Twin{}, err
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
twin, err := ts.twins.RetrieveByID(ctx, twinID)
|
2020-01-10 17:25:36 +01:00
|
|
|
if err != nil {
|
|
|
|
return Twin{}, err
|
|
|
|
}
|
|
|
|
|
|
|
|
b, err = json.Marshal(twin)
|
|
|
|
|
|
|
|
return twin, nil
|
|
|
|
}
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
func (ts *twinsService) RemoveTwin(ctx context.Context, token, twinID string) (err error) {
|
2020-01-10 17:25:36 +01:00
|
|
|
var b []byte
|
2023-04-20 22:39:33 +03:00
|
|
|
defer ts.publish(ctx, &twinID, &err, crudOp["removeSucc"], crudOp["removeFail"], &b)
|
2020-01-10 17:25:36 +01:00
|
|
|
|
2023-07-28 15:39:13 +03:00
|
|
|
_, err = ts.auth.Identify(ctx, &policies.IdentifyReq{Token: token})
|
2020-01-10 17:25:36 +01:00
|
|
|
if err != nil {
|
2022-02-01 17:33:23 +01:00
|
|
|
return errors.ErrAuthentication
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
if err := ts.twins.Remove(ctx, twinID); err != nil {
|
2020-01-10 17:25:36 +01:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
return ts.twinCache.Remove(ctx, twinID)
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-04-21 17:05:19 +02:00
|
|
|
func (ts *twinsService) ListTwins(ctx context.Context, token string, offset uint64, limit uint64, name string, metadata Metadata) (Page, error) {
|
2023-07-28 15:39:13 +03:00
|
|
|
res, err := ts.auth.Identify(ctx, &policies.IdentifyReq{Token: token})
|
2020-01-10 17:25:36 +01:00
|
|
|
if err != nil {
|
2022-02-01 17:33:23 +01:00
|
|
|
return Page{}, errors.ErrAuthentication
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
return ts.twins.RetrieveAll(ctx, res.GetId(), offset, limit, name, metadata)
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
func (ts *twinsService) ListStates(ctx context.Context, token string, offset uint64, limit uint64, twinID string) (StatesPage, error) {
|
2023-07-28 15:39:13 +03:00
|
|
|
_, err := ts.auth.Identify(ctx, &policies.IdentifyReq{Token: token})
|
2020-02-04 23:25:51 +01:00
|
|
|
if err != nil {
|
2022-02-01 17:33:23 +01:00
|
|
|
return StatesPage{}, errors.ErrAuthentication
|
2020-02-04 23:25:51 +01:00
|
|
|
}
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
return ts.states.RetrieveAll(ctx, offset, limit, twinID)
|
2020-02-04 23:25:51 +01:00
|
|
|
}
|
|
|
|
|
2023-07-06 20:57:51 +03:00
|
|
|
func (ts *twinsService) SaveStates(ctx context.Context, msg *messaging.Message) error {
|
2020-06-05 11:42:16 +02:00
|
|
|
var ids []string
|
|
|
|
|
|
|
|
channel, subtopic := msg.Channel, msg.Subtopic
|
|
|
|
ids, err := ts.twinCache.IDs(ctx, channel, subtopic)
|
2020-02-04 23:25:51 +01:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2020-06-05 11:42:16 +02:00
|
|
|
if len(ids) < 1 {
|
|
|
|
ids, err = ts.twins.RetrieveByAttribute(ctx, channel, subtopic)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if len(ids) < 1 {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
if err := ts.twinCache.SaveIDs(ctx, channel, subtopic, ids); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
2020-02-04 23:25:51 +01:00
|
|
|
|
|
|
|
for _, id := range ids {
|
2023-07-06 20:57:51 +03:00
|
|
|
if err := ts.saveState(ctx, msg, id); err != nil {
|
2020-02-04 23:25:51 +01:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-07-06 20:57:51 +03:00
|
|
|
func (ts *twinsService) saveState(ctx context.Context, msg *messaging.Message, twinID string) error {
|
2020-01-10 17:25:36 +01:00
|
|
|
var b []byte
|
|
|
|
var err error
|
2023-07-06 20:57:51 +03:00
|
|
|
|
2023-04-20 22:39:33 +03:00
|
|
|
defer ts.publish(ctx, &twinID, &err, crudOp["stateSucc"], crudOp["stateFail"], &b)
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
tw, err := ts.twins.RetrieveByID(ctx, twinID)
|
2020-01-10 17:25:36 +01:00
|
|
|
if err != nil {
|
MF-1718 - Use static code analysis in CI (#1729)
* things, twins, and logger lint fixed
Signed-off-by: aryan <aryangodara03@gmail.com>
* all services updated, auth jwt not working, ineffectual assignment issue
Signed-off-by: aryan <aryangodara03@gmail.com>
* handle error from grpc server in endpointtest
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, auth/jwt needs to be resolved
Signed-off-by: aryan <aryangodara03@gmail.com>
* revert back to jwt v4 temporarily
Signed-off-by: aryan <aryangodara03@gmail.com>
* updated jwt tokenizer
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve EOF error for httptest requests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix auth jwt, update to registeredclaims
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix ineffective assignment, auth/api/grpc endpoint failing
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, remove later
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server setup
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve golangci tests, remove debug statements
Signed-off-by: aryan <aryangodara03@gmail.com>
* update golangci version and modify linters used
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix failing tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server for setup tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix logging and errors inlined
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix remarks, update grpc setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix data race
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc setup down to single simple function
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix linting issues
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve pr comments
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix tests, handle returned errors, go mod tidy vendor
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix errors from new linters
Signed-off-by: aryan <aryangodara03@gmail.com>
---------
Signed-off-by: aryan <aryangodara03@gmail.com>
2023-04-22 08:14:35 -07:00
|
|
|
return fmt.Errorf("retrieving twin for %s failed: %s", msg.Publisher, err)
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var recs []senml.Record
|
|
|
|
if err := json.Unmarshal(msg.Payload, &recs); err != nil {
|
MF-1718 - Use static code analysis in CI (#1729)
* things, twins, and logger lint fixed
Signed-off-by: aryan <aryangodara03@gmail.com>
* all services updated, auth jwt not working, ineffectual assignment issue
Signed-off-by: aryan <aryangodara03@gmail.com>
* handle error from grpc server in endpointtest
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, auth/jwt needs to be resolved
Signed-off-by: aryan <aryangodara03@gmail.com>
* revert back to jwt v4 temporarily
Signed-off-by: aryan <aryangodara03@gmail.com>
* updated jwt tokenizer
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve EOF error for httptest requests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix auth jwt, update to registeredclaims
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix ineffective assignment, auth/api/grpc endpoint failing
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, remove later
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server setup
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve golangci tests, remove debug statements
Signed-off-by: aryan <aryangodara03@gmail.com>
* update golangci version and modify linters used
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix failing tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server for setup tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix logging and errors inlined
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix remarks, update grpc setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix data race
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc setup down to single simple function
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix linting issues
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve pr comments
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix tests, handle returned errors, go mod tidy vendor
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix errors from new linters
Signed-off-by: aryan <aryangodara03@gmail.com>
---------
Signed-off-by: aryan <aryangodara03@gmail.com>
2023-04-22 08:14:35 -07:00
|
|
|
return fmt.Errorf("unmarshal payload for %s failed: %s", msg.Publisher, err)
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
st, err := ts.states.RetrieveLast(ctx, tw.ID)
|
2020-01-10 17:25:36 +01:00
|
|
|
if err != nil {
|
MF-1718 - Use static code analysis in CI (#1729)
* things, twins, and logger lint fixed
Signed-off-by: aryan <aryangodara03@gmail.com>
* all services updated, auth jwt not working, ineffectual assignment issue
Signed-off-by: aryan <aryangodara03@gmail.com>
* handle error from grpc server in endpointtest
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, auth/jwt needs to be resolved
Signed-off-by: aryan <aryangodara03@gmail.com>
* revert back to jwt v4 temporarily
Signed-off-by: aryan <aryangodara03@gmail.com>
* updated jwt tokenizer
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve EOF error for httptest requests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix auth jwt, update to registeredclaims
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix ineffective assignment, auth/api/grpc endpoint failing
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, remove later
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server setup
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve golangci tests, remove debug statements
Signed-off-by: aryan <aryangodara03@gmail.com>
* update golangci version and modify linters used
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix failing tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server for setup tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix logging and errors inlined
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix remarks, update grpc setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix data race
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc setup down to single simple function
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix linting issues
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve pr comments
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix tests, handle returned errors, go mod tidy vendor
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix errors from new linters
Signed-off-by: aryan <aryangodara03@gmail.com>
---------
Signed-off-by: aryan <aryangodara03@gmail.com>
2023-04-22 08:14:35 -07:00
|
|
|
return fmt.Errorf("retrieve last state for %s failed: %s", msg.Publisher, err)
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-03-13 16:20:57 +01:00
|
|
|
for _, rec := range recs {
|
2020-07-09 12:18:19 +02:00
|
|
|
action := ts.prepareState(&st, &tw, rec, msg)
|
2020-03-18 19:56:39 +01:00
|
|
|
switch action {
|
|
|
|
case noop:
|
2020-03-13 16:20:57 +01:00
|
|
|
return nil
|
2020-03-18 19:56:39 +01:00
|
|
|
case update:
|
2020-06-05 11:42:16 +02:00
|
|
|
if err := ts.states.Update(ctx, st); err != nil {
|
MF-1718 - Use static code analysis in CI (#1729)
* things, twins, and logger lint fixed
Signed-off-by: aryan <aryangodara03@gmail.com>
* all services updated, auth jwt not working, ineffectual assignment issue
Signed-off-by: aryan <aryangodara03@gmail.com>
* handle error from grpc server in endpointtest
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, auth/jwt needs to be resolved
Signed-off-by: aryan <aryangodara03@gmail.com>
* revert back to jwt v4 temporarily
Signed-off-by: aryan <aryangodara03@gmail.com>
* updated jwt tokenizer
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve EOF error for httptest requests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix auth jwt, update to registeredclaims
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix ineffective assignment, auth/api/grpc endpoint failing
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, remove later
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server setup
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve golangci tests, remove debug statements
Signed-off-by: aryan <aryangodara03@gmail.com>
* update golangci version and modify linters used
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix failing tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server for setup tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix logging and errors inlined
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix remarks, update grpc setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix data race
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc setup down to single simple function
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix linting issues
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve pr comments
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix tests, handle returned errors, go mod tidy vendor
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix errors from new linters
Signed-off-by: aryan <aryangodara03@gmail.com>
---------
Signed-off-by: aryan <aryangodara03@gmail.com>
2023-04-22 08:14:35 -07:00
|
|
|
return fmt.Errorf("update state for %s failed: %s", msg.Publisher, err)
|
2020-03-18 19:56:39 +01:00
|
|
|
}
|
|
|
|
case save:
|
2020-06-05 11:42:16 +02:00
|
|
|
if err := ts.states.Save(ctx, st); err != nil {
|
MF-1718 - Use static code analysis in CI (#1729)
* things, twins, and logger lint fixed
Signed-off-by: aryan <aryangodara03@gmail.com>
* all services updated, auth jwt not working, ineffectual assignment issue
Signed-off-by: aryan <aryangodara03@gmail.com>
* handle error from grpc server in endpointtest
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, auth/jwt needs to be resolved
Signed-off-by: aryan <aryangodara03@gmail.com>
* revert back to jwt v4 temporarily
Signed-off-by: aryan <aryangodara03@gmail.com>
* updated jwt tokenizer
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve EOF error for httptest requests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix auth jwt, update to registeredclaims
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix ineffective assignment, auth/api/grpc endpoint failing
Signed-off-by: aryan <aryangodara03@gmail.com>
* temp commit, remove later
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server setup
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve golangci tests, remove debug statements
Signed-off-by: aryan <aryangodara03@gmail.com>
* update golangci version and modify linters used
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix failing tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc server for setup tests
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix logging and errors inlined
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix remarks, update grpc setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix setup_test
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix data race
Signed-off-by: aryan <aryangodara03@gmail.com>
* update setup_test grpc
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix grpc setup down to single simple function
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix linting issues
Signed-off-by: aryan <aryangodara03@gmail.com>
* resolve pr comments
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix tests, handle returned errors, go mod tidy vendor
Signed-off-by: aryan <aryangodara03@gmail.com>
* fix errors from new linters
Signed-off-by: aryan <aryangodara03@gmail.com>
---------
Signed-off-by: aryan <aryangodara03@gmail.com>
2023-04-22 08:14:35 -07:00
|
|
|
return fmt.Errorf("save state for %s failed: %s", msg.Publisher, err)
|
2020-03-18 19:56:39 +01:00
|
|
|
}
|
2020-03-13 16:20:57 +01:00
|
|
|
}
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-06-05 11:42:16 +02:00
|
|
|
twinID = msg.Publisher
|
2020-01-10 17:25:36 +01:00
|
|
|
b = msg.Payload
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-07-09 12:18:19 +02:00
|
|
|
func (ts *twinsService) prepareState(st *State, tw *Twin, rec senml.Record, msg *messaging.Message) int {
|
2020-01-10 17:25:36 +01:00
|
|
|
def := tw.Definitions[len(tw.Definitions)-1]
|
|
|
|
st.TwinID = tw.ID
|
|
|
|
st.Definition = def.ID
|
2020-01-27 02:15:10 +01:00
|
|
|
|
2020-01-10 17:25:36 +01:00
|
|
|
if st.Payload == nil {
|
|
|
|
st.Payload = make(map[string]interface{})
|
2020-05-18 18:46:50 +02:00
|
|
|
st.ID = -1 // state is incremented on save -> zero-based index
|
2020-01-27 02:15:10 +01:00
|
|
|
} else {
|
|
|
|
for k := range st.Payload {
|
2020-02-04 23:25:51 +01:00
|
|
|
idx := findAttribute(k, def.Attributes)
|
|
|
|
if idx < 0 || !def.Attributes[idx].PersistState {
|
2020-01-27 02:15:10 +01:00
|
|
|
delete(st.Payload, k)
|
|
|
|
}
|
|
|
|
}
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
|
|
|
|
2020-03-18 19:56:39 +01:00
|
|
|
recSec := rec.BaseTime + rec.Time
|
|
|
|
recNano := recSec * nanosec
|
|
|
|
sec, dec := math.Modf(recSec)
|
|
|
|
recTime := time.Unix(int64(sec), int64(dec*nanosec))
|
|
|
|
|
|
|
|
action := noop
|
2020-02-04 23:25:51 +01:00
|
|
|
for _, attr := range def.Attributes {
|
|
|
|
if !attr.PersistState {
|
2020-01-10 17:25:36 +01:00
|
|
|
continue
|
|
|
|
}
|
2020-07-09 12:18:19 +02:00
|
|
|
if attr.Channel == msg.Channel && (attr.Subtopic == SubtopicWildcard || attr.Subtopic == msg.Subtopic) {
|
2020-03-18 19:56:39 +01:00
|
|
|
action = update
|
|
|
|
delta := math.Abs(float64(st.Created.UnixNano()) - recNano)
|
|
|
|
if recNano == 0 || delta > float64(def.Delta) {
|
|
|
|
action = save
|
|
|
|
st.ID++
|
|
|
|
st.Created = time.Now()
|
|
|
|
if recNano != 0 {
|
|
|
|
st.Created = recTime
|
|
|
|
}
|
|
|
|
}
|
2020-03-13 16:20:57 +01:00
|
|
|
val := findValue(rec)
|
2020-02-18 19:56:39 +01:00
|
|
|
st.Payload[attr.Name] = val
|
2020-05-18 18:46:50 +02:00
|
|
|
|
2020-01-10 17:25:36 +01:00
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-18 19:56:39 +01:00
|
|
|
return action
|
2020-01-10 17:25:36 +01:00
|
|
|
}
|
2020-02-04 23:25:51 +01:00
|
|
|
|
2020-02-18 19:56:39 +01:00
|
|
|
func findValue(rec senml.Record) interface{} {
|
|
|
|
if rec.Value != nil {
|
|
|
|
return rec.Value
|
|
|
|
}
|
|
|
|
if rec.StringValue != nil {
|
|
|
|
return rec.StringValue
|
|
|
|
}
|
|
|
|
if rec.DataValue != nil {
|
|
|
|
return rec.DataValue
|
|
|
|
}
|
|
|
|
if rec.BoolValue != nil {
|
|
|
|
return rec.BoolValue
|
|
|
|
}
|
|
|
|
if rec.Sum != nil {
|
|
|
|
return rec.Sum
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-04 23:25:51 +01:00
|
|
|
func findAttribute(name string, attrs []Attribute) (idx int) {
|
|
|
|
for idx, attr := range attrs {
|
|
|
|
if attr.Name == name {
|
|
|
|
return idx
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1
|
|
|
|
}
|
2020-04-01 21:22:13 +02:00
|
|
|
|
2023-04-20 22:39:33 +03:00
|
|
|
func (ts *twinsService) publish(ctx context.Context, twinID *string, err *error, succOp, failOp string, payload *[]byte) {
|
2020-04-01 21:22:13 +02:00
|
|
|
if ts.channelID == "" {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
op := succOp
|
|
|
|
if *err != nil {
|
|
|
|
op = failOp
|
|
|
|
esb := []byte((*err).Error())
|
|
|
|
payload = &esb
|
|
|
|
}
|
|
|
|
|
|
|
|
pl := *payload
|
|
|
|
if pl == nil {
|
|
|
|
pl = []byte(fmt.Sprintf("{\"deleted\":\"%s\"}", *twinID))
|
|
|
|
}
|
|
|
|
|
2020-04-28 11:02:35 +02:00
|
|
|
msg := messaging.Message{
|
2020-04-01 21:22:13 +02:00
|
|
|
Channel: ts.channelID,
|
|
|
|
Subtopic: op,
|
|
|
|
Payload: pl,
|
|
|
|
Publisher: publisher,
|
2020-05-04 13:14:06 +02:00
|
|
|
Created: time.Now().UnixNano(),
|
2020-04-01 21:22:13 +02:00
|
|
|
}
|
|
|
|
|
2023-04-20 22:39:33 +03:00
|
|
|
if err := ts.publisher.Publish(ctx, msg.Channel, &msg); err != nil {
|
NOISSUE - RabbitMQ build and deployment (#1570)
* Initial commit of adding rabbitmq broker
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit of adding rabbitmq broker
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit for tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Bump up tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add more tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add go routines
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit of adding rabbitmq broker
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit of adding rabbitmq broker
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit for tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Bump up tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add more tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add go routines
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix with wait groups
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* unsubscribe to stop delivering messages
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Remove exclusivity
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Implement cancel mechanisms
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Queuename as parameter
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Queuename as parameter
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Remove broker type
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Configure broker with makefile
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Check if we have changed MESSAGE_BROKER_FILE~
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Set nats automatically
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Catching null and invalid broker type
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Remove unused fmt
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Nats
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* unexport constants
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change routingkey
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Remove wait groups
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* protecting map
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add publisher to pubsub
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change proto library
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix typos
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Reduce pubsub tests based on implementation
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Remove channel cancel
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Export constant
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Embedding publisher into pubsub
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Naming publisher
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Update rabbitmq subscriber interface
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* using publisher composition
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change contenttype
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* rename topic for publish and subscribe
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change errors to lower case
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change errors to lower case
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* export errors
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* queue per subscription
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* queue per subscription
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Merge branch 'master' into RabbitMQ-deployment
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* rename nats to broker
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change routing method
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Direct method with one exchange to many queues, one consumer per queue
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1263 - Move repeating errors to the separate package (#1540)
* MF-1263 - Mv duplicated errors to pkg/errors
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Revert test build flags
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix merge
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix comment
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Fix auth members list response (#1555)
* NOISSUE - Fix auth members list response
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Move group type next to page details
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Rm membersRes
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix typo
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1261 - Use StatusUnauthorized for authn and StatusForbidden for authz (#1538)
* MF-1261 - Use StatusUnauthorized for authn and StatusForbidden for authz
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* ErrExternalKey typo
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Rename ErrUnauthorizedAcces -> ErrAuthentication
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix bootstrap error
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix status code in openapi
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix test description
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix test description
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix test description
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Add errors cases
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix status codes
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Add gRPC stutus code
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix tests description
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix openapi and encodeError
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix grpc message
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix test descriptions
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Revert sdk error
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix typo
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1059 - Add TLS support for email (#1560)
* Use gomail package for sending emails
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
* remove print err
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
* Add vendor
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
* Rename email structure
remove logger
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
* typo in var name
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
* rename var
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
* remove MF_EMAIL_SECRET
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Refactor MQTT subscriber (#1561)
* correct suscriber interface validator + refactore token error handling
Signed-off-by: tzzed <zerouali.t@gmail.com>
* apply review suggestion
Signed-off-by: tzzed <zerouali.t@gmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1257 - Access messages from readers endpoint with user access token (#1470)
* remove owner id
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add user auth for db reader
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* add user auth for db reader
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* enable mongodb reader for user token reading
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* use uuid check for auth switch between thing key and user tok
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* enable user token reading
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* revert to correct version
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* fix endpoint test, add additional tests
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* remove logs,dead code
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* fix logging messages
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* remove auth interface, add authorization header type
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* update api doc
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* remove unused package
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* some refactor of cases for authorization switch
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* correct description in openapi
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* fix endpoint test to match auth service change
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* some rename
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* initialize auth url
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* add env variables for auth service
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* fix spelling
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* Things prefix and no prefix for Thing authorization, Bearer for user
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* update readme file
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* fix default things grpc port
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* enable user reading for timescaledb
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* remove not used error
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* improve errors
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* refactor authorize
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* add chanID check
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* inline some error checking
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* fixing errors
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* fixing errors
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* improve test case description
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* remove test code
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* dont inline
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* refactor a bit encodeError
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* remove unused error
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* remove unused error
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* fix things auth grpc url
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
* rename variables for header prefix
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit of adding rabbitmq broker
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit of adding rabbitmq broker
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit for tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Bump up tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add more tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add go routines
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit of adding rabbitmq broker
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Initial commit for tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Bump up tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add more tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add go routines
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix with wait groups
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* unsubscribe to stop delivering messages
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Remove exclusivity
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1551 - Fix Cobra usage commands and clean unnecessary struct types (#1558)
* MF-1551 - Fix Cobra usage commands and clean unnecessary struct types
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Use linux syntax for cmd usage description
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix typo
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix cmd.Use
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Separate Keto hosts for read and write (#1563)
* Separate keto hosts for read and write
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
* update readme with new envars
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
* rename read connection name
Signed-off-by: Ivan Milosevic <iva@blokovi.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Update dependencies (#1564)
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1240 - Return to service transport layer only service errors (#1559)
* MF-1240 - Return to service transport layer only service errors
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Remove unecessary errors
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Rm duplicated errors and fix transport
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Revert http endpoint_test
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix conflict
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Implement cancel mechanisms
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Queuename as parameter
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Queuename as parameter
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1469 - Indicate proper authentication scheme in Authorization header (#1523)
* MF-1469 - Indicate proper authentication scheme in Authorization header
Signed-off-by: Stefan Kovacevic <jen2tri@gmail.com>
* Fixing the remarks on the last push
Signed-off-by: Stefan Kovacevic <jen2tri@gmail.com>
* Remove Bearer prefix in all services and fix tests
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix remarks
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Co-authored-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Add nats wrapper for COAP (#1569)
* Add nats wrapper for COAP
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Pass pubsub as argument
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Defer close connection
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Defer close connection
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Rename endpoint to topic
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1348 - Add transport errors logging (#1544)
* MF-1348 - Add go-kit transport level logging
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 merge
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix remark
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix go test flags
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Use httputil errors in things and http service
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix SDK tests
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Use httputil errors in certs and provision service
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Use httputil errors in consumers service
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* General renaming and add ErrMissingToken
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Rename httputil -> apiutil and use errors in users servive
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Use apiutil errors in auth, bootstrap, readers, things and twins
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Replace errors.Contain by comparison
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix remarks
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Simplify validateID
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Simplify validateID
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Simplify and rename ExtractAuthToken -> ExtractBearerToken
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix readers
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix auth key test and remarks
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Improve comment
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Simplify validateUUID check
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix typo
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1567 - Use Bearer, Thing or Basic scheme in Authorization header (#1568)
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1565 - Document Bearer, Thing and Basic Authorization header (#1566)
* MF-1565 - Document Bearer Authorization header
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix auth, bootstrap, http and readers openapi
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix openapi
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Add enc key for bootstrap
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix typo
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Use global security
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix bearer formats
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Polish descriptions
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Fix boostrap and typo
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1575 Add 'Name' field to ListMembers response in things svc (#1576)
Signed-off-by: Ivan Balboteo <ivan@submer.com>
Co-authored-by: Ivan Balboteo <ivan@submer.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1580 - Influxdb Writer changes format of update-time to string (#1581)
* - MF-1580
- Modified consumers/writers/influxdb/fields.go
- influxdb-writer used to update data type of update-time to string
- Commented line 12 of consumers/writers/influxdb/fields.go to resolve
uneccessary data type conversion issue
Signed-off-by: Hasan Tariq <hasantariqashraf@gmail.com>
* - MF-1580
- Removed strconv package from consumers/writers/influxdb/fields.go since it is no longer needed
- Removed line 12 from consumers/writers/influxdb/fields.go
- Replaced retrun value of updateTime with msg.UpdateTime (line 16 in
fields.go)
Signed-off-by: Hasan Tariq <hasantariqashraf@gmail.com>
* Fix InflxuDB readers
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Hasan Tariq <hasant@plcgroup.com>
Co-authored-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Unify MF_INFLUX_READER_DB_HOST and MF_INFLUX_WRITER_DB_HOST envars (#1585)
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Fix CoAP adapter (#1572)
* Revert "NOISSUE - Add nats wrapper for COAP (#1569)"
This reverts commit cc5d5195ab27fa94270ada616487b7053fd9c7bd.
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Fix CoAP adapter
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Update CoAP observation cancel
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Fix observe
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Fix GET handling
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Revert authorization
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Use constants instead of magic numbers
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Remove an empty line
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Extract special observe value to constant
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1582 - Fix lora-adapter MQTT client (#1583)
* MF-1582 - Fix lora-adapter MQTT clien
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Add timeout config to the mqtt subscriber
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Rm comment
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
* Add sub timeout
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Update changelog and readme for release 0.13.0 (#1592)
* Update release example
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Update changelog and examples for 0.13.0 release
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Update VerneMQ release (#1593)
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Update changelog for release 0.13.0 (#1595)
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* unexport constants
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change routingkey
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Remove wait groups
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* protecting map
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add publisher to pubsub
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change proto library
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix typos
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Reduce pubsub tests based on implementation
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Remove channel cancel
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Export constant
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Move invariant statements out of loop for cassandra-writer (#1596)
Signed-off-by: fuzhy <fuzhy1997@outlook.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Embedding publisher into pubsub
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Naming publisher
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Fix Nginx entrypoint script (#1597)
* Fix Nginx entrypoint script
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Update dependencies
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Fix NginX entrypoint
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Revert Makefile changes
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1525 - Add graceful stop for HTTP and GRPC servers (#1548)
* Add : errgroup to cmd/auth
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add : Handle graceful stop for auth service
Remove : errgroups from auth service
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add : Wait till server shutdown
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Change : instead of waitgroup changed to errgroups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* change : KillSignalHandler return type to error
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Empty Commit
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add : Context to http server shutdown
Rename : varaible from proto to protocol
Signed-off-by: Arvindh <arvindh91@gmail.com>
* change : to default log level
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add : Sign-off
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add: graceful stop of http and grpc server
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Fix: typos and caps
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add: Signed-off
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Rename: Func KillSignalHandler to SignalHandler
Add: SIGABRT
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Fix: auth service
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add: timeout for grpc gracefulstop
Fix: typos
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add: .vscode folder to git ignore
Signed-off-by: Arvindh <arvindh91@gmail.com>
* change: variable name to stopWaitTime
Signed-off-by: Arvindh <arvindh91@gmail.com>
* remove: .vscode folder
Signed-off-by: Arvindh <arvindh91@gmail.com>
* remove: .vscode from .gitignore
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add : logger to handlers
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Add : New line at end of .gitignore file
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Fix : variable naming
Add : graceful stop for timescale
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Remove : unsued NATS library from import
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Move: "https" and "https" to moved to const var
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Move: "http" and "https" to moved to const var
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: branch with master
Signed-off-by: Arvindh <arvindh91@gmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF-1588 - Update Subscriber interface (#1598)
* Initial commit
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Update subscriber interface
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* check subscription map
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Check topic id after topic
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* reword description
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Setup empty queue
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change mqtt implementation
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Switch statements
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Simplify
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change mqtt subscriber
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Protect subscription map
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix subscription
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Set client id
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Format
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change delete method
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Update rabbitmq subscriber interface
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* using publisher composition
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change contenttype
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* rename topic for publish and subscribe
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change errors to lower case
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change errors to lower case
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* export errors
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* MF - 1590 - Fix fetching list of users with a zero limit (#1594)
* Add max and min limit size
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Format
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Format
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* NOISSUE - Retrieve client key on cert issuing (#1607)
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* fix bug (#1604)
Signed-off-by: zhangchuanfeng <654300242@qq.com>
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* queue per subscription
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* queue per subscription
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change routing method
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Direct method with one exchange to many queues, one consumer per queue
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* :recycle: Not casting data
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* :pencil2: Fix typo
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* :recycle: remove passed queue name
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* :fire: removing echange kind
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Combine tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Refactor unsubscribe method
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix merge conflict
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* :white_check_mark: sub and unsub to dummy topic
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* generate client id from topic and ID
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Rename topicID to clientID
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* update tests
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* merge changes
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* :recycle: rename constant and variable declaration
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* rename to brokers
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* :recycle: Rename brokers
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change mqtt implementation
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Rename broker to brokers
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* include nats port
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* move to build tags
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* move to build tags
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* add nats build tag to test
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* \n at the end of file
Signed-off-by: GitHub <noreply@github.com>
* Add init function
Signed-off-by: GitHub <noreply@github.com>
* Add init function
Signed-off-by: GitHub <noreply@github.com>
* broker url automatically
Signed-off-by: GitHub <noreply@github.com>
* make nats as the default broker
Signed-off-by: GitHub <noreply@github.com>
* Updated publisher and subscriber interface
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Add error to close
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Change image version and let user define URI
Signed-off-by: GitHub <noreply@github.com>
* make broker url configurable
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* add compile check
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* rabbitmq check
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* default broker to nats
Signed-off-by: GitHub <noreply@github.com>
* change broker url in docker compose
Signed-off-by: GitHub <noreply@github.com>
* Fix ci
Signed-off-by: GitHub <noreply@github.com>
* fix makefile
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix env var and ci
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix ci
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
* Fix consts
Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Co-authored-by: Manuel Imperiale <manuel.Imperiale@gmail.com>
Co-authored-by: Ivan Milošević <iva@blokovi.com>
Co-authored-by: __touk__ <zerouali.t@gmail.com>
Co-authored-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Co-authored-by: stefankovacevic123 <jen2tri@gmail.com>
Co-authored-by: ibalboteo <ivanbalboteo@gmail.com>
Co-authored-by: Ivan Balboteo <ivan@submer.com>
Co-authored-by: Hasan98-git <67228396+Hasan98-git@users.noreply.github.com>
Co-authored-by: Hasan Tariq <hasant@plcgroup.com>
Co-authored-by: fuzhy <fuzhy1997@outlook.com>
Co-authored-by: Arvindh <30824765+arvindh123@users.noreply.github.com>
Co-authored-by: 张传峰 <59160162+zhang-chuanfeng@users.noreply.github.com>
2022-06-21 18:40:20 +03:00
|
|
|
ts.logger.Warn(fmt.Sprintf("Failed to publish notification on Message Broker: %s", err))
|
2020-04-01 21:22:13 +02:00
|
|
|
}
|
|
|
|
}
|