Mainflux.mainflux/http/api/endpoint.go

20 lines
414 B
Go
Raw Normal View History

// Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
package api
import (
"context"
"github.com/go-kit/kit/endpoint"
NOISSUE - Create broker package for NATS (#1080) * NOISSUEE - Create broker package for NATS Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Create funcs to return NATS connection Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * mv os.exit to main Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix Reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix tests and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix CI Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Unify Publisher and Subscriber interfaces Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename Nats interface Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * typo Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv message.pb.go, messsage.proto and topics.go to broker directory Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix go.mod Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use mainflux broker for writers and twins services Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix go.mod Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix twins tests Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix make proto Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix message.proto Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix golangcibot Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * regenerate message.pb.go Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix comment Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix comment Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix make proto Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add NATS errors Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2020-04-02 03:22:13 +08:00
"github.com/mainflux/mainflux/http"
)
NOISSUE - Create broker package for NATS (#1080) * NOISSUEE - Create broker package for NATS Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Create funcs to return NATS connection Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * mv os.exit to main Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix Reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix tests and typos Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix CI Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix reviews Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Unify Publisher and Subscriber interfaces Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rename Nats interface Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * typo Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Mv message.pb.go, messsage.proto and topics.go to broker directory Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix go.mod Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Use mainflux broker for writers and twins services Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix go.mod Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix twins tests Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix make proto Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix message.proto Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix golangcibot Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * regenerate message.pb.go Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix comment Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix comment Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Fix make proto Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Add NATS errors Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2020-04-02 03:22:13 +08:00
func sendMessageEndpoint(svc http.Service) endpoint.Endpoint {
2019-07-18 21:01:09 +08:00
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(publishReq)
err := svc.Publish(ctx, req.token, req.msg)
return nil, err
}
}