How to Connect Gateway to MQTT-Apache-Apollo Server 

MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.
Table of Contents

What’s MQTT?

MQTT is a machine-to-machine (M2M)/”Internet of Things” connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium. For example, it has been used in sensors communicating to a broker via satellite link, over occasional dial-up connections with healthcare providers, and in a range of home automation and small device scenarios. It is also ideal for mobile applications because of its small size, low power usage, minimized data packets, and efficient distribution of information to one or many receivers.

Dusun gateway supports MQTT protocol to connect to the cloud platform, please refer to the frame below

Dusun gateway supports MQTT protocol to

How to set up MQTT apache-Apollo server?

1. Download and Install JDK

Go to the JDK download page:

http://www.oracle.com/technetwork/java/javase/downloads/ index.html

You will find the following chart on the page.

Download and install JDK

Download the X86 or X64 windows JDK file according to users’ windows version. Launch the file “jdk-82u211-*. exe” and perform a default install. Then you will see two folders in the /windows/program files/java folder, one is JDK, the other is JRE, as the figure below shows.

JDK files

2. Set JDK Environment Variables in Windows

Open Advanced System Settings

JDK advanced System Setting 2
JDK advanced System Setting 1

In Windows 10 press Windows key + Pause Key, this will open the System Settings window. Go to Change settings and select the Advanced Tab. Alternatively: Open “Windows search” – you will find it next to the Windows logo. In the search field type in – advanced system settings, then click on the match on top of the list.

Set JAVA_HOME Environment variable

In “System Properties window” click “Environment Variables…”

Set JAVA HOME Environment

Under “System variables” click the “New…” button and enter JAVA_HOME as “Variable name” and the path to your Java JDK directory under “Variable value”.

JDK system variables

Update System PATH

  1. In “Environment Variables” window under “System variables” select Path
  2. Click on “Edit…”
  3. In “Edit environment variable” window click “New”
  4. Type in %JAVA_HOME%\bin
update system path

Test your configuration

Open a new command prompt and type in:

Command: Java -version

This will print out the version of the java if the Path variable is set correctly

Test your configuration

3. Download Apache-apollo and install

Use the links below to download the Apache-appollo software for windows:

http://mirrors.hust.edu.cn/apache/activemq/activemq-apollo/1.7.1/apache-apollo-1.7.1-windows-distro.zip

Uncompress the package to a local drive (e.g. E:)

apache appollo

Run cmd with administrator privilege and use cd command to locate the apache-apollo bin directory as the figure below shows:

run cmd

Type in command:”apollo create myapollo c:\apache-apollo\broker” to create the broker:

input command

The following directory appears in c:\ root directory.

root directory
Open a new command prompt and type in: “cd c:\apache-apollo\broker\bin\; apollo-broker run”, this will print out the following information:
apollo broker

Open a web browser and type in http://127.0.0.1:61680/, username: admin, password:password

open appollo console

Then the MQTT server has been setup successfully, but right now, there are no devices connecting to this server:

connections

4. Configure a Dusun Gateway to Connect to the Server​

1561886620403

Connect a Dusun gateway to a PC; open a web browser and type in – 192.168.66.1; then log in the gateway to do some configuration:

Authorization required

Username: root

Password: root

Configure MQTT in the configuration page:

MQTT server

Setting up the MQTT configuration as below:

mqtt server address

MQTT Server address: fill in the PC’s IP address.

Network2
MQTT Server Port: the TCP port
TCP port

Username: admin

Mqtt Password: password

Press enter and the Mqtt configuration is completed.

You can see the gateway indication light is off and the gateway has connected to the server:

Connector
Related IoT Product Specifications

MIR-MC100 Door/Window Sensor

The window door sensor monitors the opening and closing status of entry points, and sends alerts to the alarm system when necessary. Surface-mounted. Wholesale prices

Looking For An IoT Device Supplier For Your Projects?

CONTACT US

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    IoT Gateways for Recommendation

    CONTACT US

      This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

      Welcome to DusunIoT

      Hi there 👋 Is there anything we can help you with today? Please fill in the form below for the team to follow up if you become disconnected.

        DusunIoT Distributor Program

          This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

            This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.