From dd6747063601c0be6be8148c12d6da6e0d0465b6 Mon Sep 17 00:00:00 2001 From: Sammy Kerata Oina <44265300+SammyOina@users.noreply.github.com> Date: Tue, 1 Aug 2023 22:41:04 +0300 Subject: [PATCH] NOISSUE - Update edge documentation (#152) * update documentation for export test Signed-off-by: SammyOina * remove tags arg Signed-off-by: SammyOina * update dev guide description Signed-off-by: SammyOina --------- Signed-off-by: SammyOina --- docs/dev-guide.md | 18 ++++++++++++------ docs/edge.md | 10 ++++++---- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/dev-guide.md b/docs/dev-guide.md index f316ee32..73f89d2d 100644 --- a/docs/dev-guide.md +++ b/docs/dev-guide.md @@ -226,22 +226,28 @@ which will do this copying of the binaries. Mainflux depends on several infrastructural services, notably the default message broker, [NATS](https://www.nats.io/) and [PostgreSQL](https://www.postgresql.org/) database. #### Message Broker + Mainflux uses NATS as it's default central message bus. For development purposes (when not run via Docker), it expects that NATS is installed on the local system. To do this execute: -``` -go get github.com/nats-io/gnatsd +```bash +go install github.com/nats-io/nats-server/v2@latest ``` -This will install `gnatsd` binary that can be simply run by executing: +This will install `nats-server` binary that can be simply run by executing: -``` -gnatsd +```bash +nats-server ``` -If you want to change the default message broker to [RabbitMQ](https://www.rabbitmq.com/download.html), [VerneMQ](https://vernemq.com/downloads/) or [Kafka](https://kafka.apache.org/quickstart) you need to install it on the local system. +If you want to change the default message broker to [RabbitMQ](https://www.rabbitmq.com/download.html) or [VerneMQ](https://vernemq.com/downloads/) you need to install it on the local system. +To run using a different broker you need to set the `MF_BROKER_TYPE` env variable to `nats`, `rabbitmq` or `vernemq` during make and run process. +```bash +MF_BROKER_TYPE= make +MF_BROKER_TYPE= make run +``` #### PostgreSQL Mainflux uses PostgreSQL to store metadata (`users`, `things` and `channels` entities alongside with authorization tokens). diff --git a/docs/edge.md b/docs/edge.md index 29945aff..c07a3845 100644 --- a/docs/edge.md +++ b/docs/edge.md @@ -530,19 +530,20 @@ cd build #### Testing Export ```bash -git clone https://github.com/nats-io/nats.go -cd github.com/nats-io/nats.go/examples/nats-pub -go run main.go -s http://localhost:4222 export.test "[{\"bn\":\"test\"}]"; +git clone https://github.com/mainflux/agent +go run ./examples/publish/main.go -s http://localhost:4222 export.test "[{\"bn\":\"test\"}]"; ``` -We have configured route for export, `nats_topic = ">"` means that it will listen to `NATS` subject `export.>` and `mqtt_topic` is configured so that data will be sent to MQTT broker on topic `channels/e2adcfa6-96b2-425d-8cd4-ff8cb9c056ce/messages` with appended `NATS` subject. +We have configured route for export, `nats_topic = ">"` means that it will listen to `NATS` subject `export.>` and `mqtt_topic` is configured so that data will be sent to MQTT broker on topic `channels/e2adcfa6-96b2-425d-8cd4-ff8cb9c056ce/messages` with appended `NATS` subject. Other brokers can such as `rabbitmq` can be used, for more detail refer to [dev-guide][dev-guide]. In terminal where export is started you should see following message: + ```log {"level":"debug","message":"Published to: export.test, payload: [{\"bn\":\"test\"}]","ts":"2020-05-08T15:14:15.757298992Z"} ``` In Mainflux `mqtt` service: + ```log mainflux-mqtt | {"level":"info","message":"Publish - client ID export-88529fb2-6c1e-4b60-b9ab-73b5d89f7404 to the topic: channels/e2adcfa6-96b2-425d-8cd4-ff8cb9c056ce/messages/export/test","ts":"2020-05-08T15:16:02.999684791Z"} ``` @@ -552,3 +553,4 @@ mainflux-mqtt | {"level":"info","message":"Publish - client ID export-88529fb2 [env]:(https://github.com/mainflux/export#environmet-variables) [agent]:(https://github.com/mainflux/agent) [protomsg]:https://github.com/mainflux/mainflux/blob/master/pkg/messaging/message.proto +[dev-guide]: /docs/dev-guide.md/#message-broker