Skip to content

Commit

Permalink
NOISSUE - Update edge documentation (#152)
Browse files Browse the repository at this point in the history
* update documentation for export test

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove tags arg

Signed-off-by: SammyOina <sammyoina@gmail.com>

* update dev guide description

Signed-off-by: SammyOina <sammyoina@gmail.com>

---------

Signed-off-by: SammyOina <sammyoina@gmail.com>
  • Loading branch information
SammyOina authored Aug 1, 2023
1 parent b9fde98 commit dd67470
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
18 changes: 12 additions & 6 deletions docs/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<broker-type> make
MF_BROKER_TYPE=<broker-type> make run
```

#### PostgreSQL
Mainflux uses PostgreSQL to store metadata (`users`, `things` and `channels` entities alongside with authorization tokens).
Expand Down
10 changes: 6 additions & 4 deletions docs/edge.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
```
Expand All @@ -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

0 comments on commit dd67470

Please sign in to comment.