Get subscription relationship from Redis

    Create rules:

    Open EMQX Dashboard (opens new window) and select the “Rules” tab on the left.

    Then fill in the rule SQL:

    Get subscription from Redis - 图2

    Related actions:

    Select “Add Action” on the “Response Action” interface, and then select “Get Subscription List from Redis” in the “Add Action” drop-down box.

    Fill in the action parameters:

    1). Associated resources. The resource drop-down box is empty now, and you can click “New” in the upper right corner to create a Redis resource:

    Get subscription from Redis - 图4

    Select “Redis single-node mode resources”.

    Fill in the resource configuration:

    Fill in the real Redis server address and keep other configurations at default values. Then, click the “Test Connection” button to ensure that the connection test is successful.

    Finally click the “Create” button.

    Get subscription from Redis - 图6

    Return to the rule creation interface and click “Create”.

    Get subscription from Redis - 图8

    The rule has been created, and you can insert a subscription relationship into Redis through Redis CLI:

    Log in to the device whose clientid is test via Dashboard:

    Get subscription from Redis - 图10

    Check the subscription list, and you can see that the test device has subscribed to the t1 topic: