Data to HStreamDB

    For more details, please refer to HStream official websiteSave data to HStreamDB - 图2 (opens new window)

    Refer to the following documents (opens new window) for deployment instructions, which provide tutorials on deploying with docker locally or on the cloud.

    Use the command to start an hstream-client

    When entering the console, help info like these will be shown:

    1. / / / / ___/_ __/ __ \/ ____/ | / |/ /
    2. / /_/ /\__ \ / / / /_/ / __/ / /| | / /|_/ /
    3. /_/ /_//____//_/ /_/ |_/_____/_/ |_/_/ /_/
    4. Command
    5. :q To exit command line interface

    Create stream:

    image

    Click on Rules Engine > Resources > Create, then select resources type HStreamDB.

    Edit the rule SQL.

    1. SELECT
    2. FROM

    The SQL rules in the document are for demonstrations only, please write the SQL according to the business design.

    Click Add Action and select Data Persistence to save the data to HSTreamDB. Select the resource created in the previous step and enter the parameters, which are defined in the following table.

    Click Confirm to create it.

    Now use the state-of-the-art MQTT desktop client MQTTX to connect to EMQX and send a message.

    See rule monitor.

    image

    At this point the data is written to HStreamDB and the message is consumed using any consumption method. The documentation uses a simple consumption tool based on the HStream golang SDK, and the reader is free to write the consumption side according to a familiar programming language. The consumption log can be seen as follows. Test tool see .

    1. {"level":"info","ts":1656311005.5250711,"msg":"[f1]","recordId":"[BatchId: 8589934593, BatchIndex: 0, ShardId: 1317059070792293]","payload":"Hello HSreamDB !"}

    The message has been written successfully and is consumed to completion.