• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #4380

25 Jun 2025 06:58AM UTC coverage: 62.307% (-0.09%) from 62.393%
#4380

push

travis-ci

web-flow
feat(mqtt): mqtt subscription (#30127)

* feat(mqtt): Initial commit for mqtt

* chore(xnode/mnd): xnode message handlers for mnode

* chore(mnd/xnode): mnode part for xnode

* chore(xnode/translater): fix show commands

* fix(ast/creater): fix xnode create option

* fix(xnode/ci): fix ci & doc's error codes

* chore(xnode/sql): make create/drop/show work properly

* fix(xnode/sql): commit new files

* fix(xnode/sql): commit cmake files

* fix: fix testing cases

* fix(xnode/tsc): fix tokens

* fix(ast/anode): fix anode update decl.

* fix(xnode/error): fix xnode error codes

* fix: xnode make/destroy

* chore: xnode with option & dnode id

* chore: use taosmqtt for xnode

* chore: new error code for xnode launching

* chore(xnode): new error code

* chore: header for _xnode_mgmt_mqtt

* chore: source for _xnode_mgmt_mqtt

* chore: remove test directory from cmake

* chore: remove taosmqtt for ci to compile

* chore: remove taosudf header from xnode

* chore: new window macro

* chore: remove xnode mgmt mqtt for windows compilation

* Revert "chore: remove xnode mgmt mqtt for windows compilation"

This reverts commit 197e1640c.

* chore: cleanup code

* chore: xnode mgmt comment windows part out

* chore: mgmt/mqtt, move uv head toppest

* xnode/mnode: create xnode once per dnode

* fix(xnode/systable/test): fix column count

* xnode/sdb: renumber sdb type for xnode to make start/stop order correct

* xnode/mqtt: new param mqttPort

* fix SXnode's struct type

* transfer dnode id to mqtt subscription

* tmqtt: remove uv_a linking

* tmqtt/tools: sources for tools

* tools: fix windows compilation

* tools/producer: fix windows sleep param

* tools/producer: fix uninited var rc

* make tools only for linux

* test/mnodes: wail 1 or 2 seconds for offline to be leader

* update topic producer tool for geometry data type testing

* format tool sql statements

* show xnodes' ep

* make shell auto complete xnodes

* use usleep... (continued)

156642 of 320746 branches covered (48.84%)

Branch coverage included in aggregate %.

61 of 1020 new or added lines in 21 files covered. (5.98%)

1736 existing lines in 172 files now uncovered.

242538 of 319922 relevant lines covered (75.81%)

6277604.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/source/dnode/bnode/src/bnode.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15

16
#include "libs/tmqtt/tmqtt.h"
17
#include "bndInt.h"
18

NEW
19
int32_t bndOpen(const SBnodeOpt *pOption, SBnode **pBnode) {
×
NEW
20
  int32_t code = 0;
×
21

NEW
22
  *pBnode = taosMemoryCalloc(1, sizeof(SBnode));
×
NEW
23
  if (NULL == *pBnode) {
×
NEW
24
    bndError("calloc SBnode failed");
×
NEW
25
    code = terrno;
×
NEW
26
    TAOS_RETURN(code);
×
27
  }
28

NEW
29
  (*pBnode)->msgCb = pOption->msgCb;
×
NEW
30
  (*pBnode)->dnodeId = pOption->dnodeId;
×
NEW
31
  (*pBnode)->protocol = (int8_t)pOption->proto;
×
32

NEW
33
  if (TSDB_BNODE_OPT_PROTO_MQTT == (*pBnode)->protocol) {
×
NEW
34
    if ((code = mqttMgmtStartMqttd((*pBnode)->dnodeId)) != 0) {
×
NEW
35
      bndError("failed to start taosudf since %s", tstrerror(code));
×
36

NEW
37
      taosMemoryFree(*pBnode);
×
NEW
38
      TAOS_RETURN(code);
×
39
    }
40
  } else {
NEW
41
    bndError("Unknown bnode proto: %hhd.", (*pBnode)->protocol);
×
42

NEW
43
    taosMemoryFree(*pBnode);
×
NEW
44
    TAOS_RETURN(code);
×
45
  }
46

NEW
47
  bndInfo("Bnode opened.");
×
48

NEW
49
  return TSDB_CODE_SUCCESS;
×
50
}
51

NEW
52
void bndClose(SBnode *pBnode) {
×
NEW
53
  mqttMgmtStopMqttd();
×
54

NEW
55
  taosMemoryFree(pBnode);
×
56

NEW
57
  bndInfo("Bnode closed.");
×
NEW
58
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc