# Bridge data to EMQX

Setup another MQTT broker using emqx, taking Mac OSX for instance:

$ brew tap emqx/emqx/emqx

$ brew install emqx

# start emqx
$ emqx console
1
2
3
4
5
6

Create a rule:

Go to emqx dashboard (opens new window), select the "rule" tab on the menu to the left.

Select "message.publish", then type in the following SQL:

SELECT
    *
FROM
    "message.publish"
1
2
3
4

image

Bind an action:

Click on the "+ Add" button under "Action Handler", and then select "Data bridge to MQTT Broker" in the pop-up dialog window.

image

Bind a resource to the action. Since the dropdown list "Resource" is empty for now, we create a new resource by clicking on the "New Resource" to the top right, and then select "MQTT Bridge":

image

Configure the resource:

Set "EMQ X Node Name" to the node name of the remote name, and keep
all other configs as default, and click on the "Testing Connection"
button to make sure the connection can be created successfully, and
then click on the "Create" button.
1
2
3
4

image

Back to the "Actions" dialog, and then click on the "Confirm" button.

image

Back to the creating rule page, then click on "Create" button. The rule we created will be show in the rule list:

image

We have finished, testing the rule by sending an MQTT message to emqx:

Topic: "t/1"

QoS: 0

Retained: false

Payload: "Hello, World\!"
1
2
3
4
5
6
7

Then verify a message has been published to the other emqx:

image

And from the rule list, verify that the "Matched" column has increased to 1:

image