Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
60191bef
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
60191bef
编写于
8月 14, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:tmq interface & remove snapshot code
上级
0fc4546c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
47 deletion
+31
-47
docs/en/14-reference/03-connector/04-java.mdx
docs/en/14-reference/03-connector/04-java.mdx
+0
-3
docs/examples/c/tmq_example.c
docs/examples/c/tmq_example.c
+0
-6
docs/examples/go/sub/main.go
docs/examples/go/sub/main.go
+0
-1
docs/zh/08-connector/10-cpp.mdx
docs/zh/08-connector/10-cpp.mdx
+9
-0
examples/c/tmq.c
examples/c/tmq.c
+0
-5
include/client/taos.h
include/client/taos.h
+22
-32
未找到文件。
docs/en/14-reference/03-connector/04-java.mdx
浏览文件 @
60191bef
...
...
@@ -1091,8 +1091,6 @@ public abstract class ConsumerLoop {
config.setProperty("client.id", "1");
config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer");
config.setProperty("value.deserializer.encoding", "UTF-8");
config.setProperty("experimental.snapshot.enable", "true");
this.consumer = new TaosConsumer<>(config);
this.topics = Collections.singletonList("topic_speed");
...
...
@@ -1176,7 +1174,6 @@ public abstract class ConsumerLoop {
config.setProperty("client.id", "1");
config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer");
config.setProperty("value.deserializer.encoding", "UTF-8");
config.setProperty("experimental.snapshot.enable", "true");
this.consumer = new TaosConsumer<>(config);
this.topics = Collections.singletonList("topic_speed");
...
...
docs/examples/c/tmq_example.c
浏览文件 @
60191bef
...
...
@@ -227,12 +227,6 @@ tmq_t* build_consumer() {
return
NULL
;
}
code
=
tmq_conf_set
(
conf
,
"experimental.snapshot.enable"
,
"false"
);
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
tmq_conf_set_auto_commit_cb
(
conf
,
tmq_commit_cb_print
,
NULL
);
tmq_t
*
tmq
=
tmq_consumer_new
(
conf
,
NULL
,
0
);
...
...
docs/examples/go/sub/main.go
浏览文件 @
60191bef
...
...
@@ -35,7 +35,6 @@ func main() {
"td.connect.port"
:
"6030"
,
"client.id"
:
"test_tmq_client"
,
"enable.auto.commit"
:
"false"
,
"experimental.snapshot.enable"
:
"true"
,
"msg.with.table.name"
:
"true"
,
})
if
err
!=
nil
{
...
...
docs/zh/08-connector/10-cpp.mdx
浏览文件 @
60191bef
...
...
@@ -515,3 +515,12 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多
- 带_raw的接口通过传递的参数lines指针和长度len来表示数据,为了解决原始接口数据包含'\0'而被截断的问题。totalRows指针返回解析出来的数据行数。
- 带_ttl的接口可以传递ttl参数来控制建表的ttl到期时间。
- 带_reqid的接口可以通过传递reqid参数来追踪整个的调用链。
### 数据订阅 API
除了使用 SQL 方式或者使用参数绑定 API 写入数据外,还可以使用 Schemaless 的方式完成写入。Schemaless 可以免于预先创建超级表/数据子表的数据结构,而是可以直接写入数据,TDengine 系统会根据写入的数据内容自动创建和维护所需要的表结构。Schemaless 的使用方式详见 [Schemaless 写入](/reference/schemaless/) 章节,这里介绍与之配套使用的 C/C++ API。
- `TAOS_RES* taos_schemaless_insert(TAOS* taos, const char* lines[], int numLines, int protocol, int precision)`
**功能说明**
该接口将行协议的文本数据写入到 TDengine 中。
examples/c/tmq.c
浏览文件 @
60191bef
...
...
@@ -228,11 +228,6 @@ tmq_t* build_consumer() {
tmq_conf_destroy
(
conf
);
return
NULL
;
}
code
=
tmq_conf_set
(
conf
,
"experimental.snapshot.enable"
,
"false"
);
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
tmq_conf_set_auto_commit_cb
(
conf
,
tmq_commit_cb_print
,
NULL
);
tmq
=
tmq_consumer_new
(
conf
,
NULL
,
0
);
...
...
include/client/taos.h
浏览文件 @
60191bef
...
...
@@ -260,19 +260,14 @@ typedef struct tmq_t tmq_t;
typedef
struct
tmq_conf_t
tmq_conf_t
;
typedef
struct
tmq_list_t
tmq_list_t
;
typedef
void
(
tmq_commit_cb
(
tmq_t
*
,
int32_t
code
,
void
*
param
));
typedef
void
(
tmq_commit_cb
(
tmq_t
*
tmq
,
int32_t
code
,
void
*
param
));
DLL_EXPORT
tmq_list_t
*
tmq_list_new
();
DLL_EXPORT
int32_t
tmq_list_append
(
tmq_list_t
*
,
const
char
*
);
DLL_EXPORT
void
tmq_list_destroy
(
tmq_list_t
*
);
DLL_EXPORT
int32_t
tmq_list_get_size
(
const
tmq_list_t
*
);
DLL_EXPORT
char
**
tmq_list_to_c_array
(
const
tmq_list_t
*
);
DLL_EXPORT
tmq_t
*
tmq_consumer_new
(
tmq_conf_t
*
conf
,
char
*
errstr
,
int32_t
errstrLen
);
DLL_EXPORT
const
char
*
tmq_err2str
(
int32_t
code
);
typedef
enum
tmq_conf_res_t
{
TMQ_CONF_UNKNOWN
=
-
2
,
TMQ_CONF_INVALID
=
-
1
,
TMQ_CONF_OK
=
0
,
}
tmq_conf_res_t
;
/* ------------------------TMQ CONSUMER INTERFACE------------------------ */
typedef
struct
tmq_topic_assignment
{
int32_t
vgId
;
int64_t
currentOffset
;
...
...
@@ -280,6 +275,18 @@ typedef struct tmq_topic_assignment {
int64_t
end
;
}
tmq_topic_assignment
;
DLL_EXPORT
tmq_conf_t
*
tmq_conf_new
();
DLL_EXPORT
tmq_conf_res_t
tmq_conf_set
(
tmq_conf_t
*
conf
,
const
char
*
key
,
const
char
*
value
);
DLL_EXPORT
void
tmq_conf_destroy
(
tmq_conf_t
*
conf
);
DLL_EXPORT
void
tmq_conf_set_auto_commit_cb
(
tmq_conf_t
*
conf
,
tmq_commit_cb
*
cb
,
void
*
param
);
DLL_EXPORT
tmq_list_t
*
tmq_list_new
();
DLL_EXPORT
int32_t
tmq_list_append
(
tmq_list_t
*
,
const
char
*
);
DLL_EXPORT
void
tmq_list_destroy
(
tmq_list_t
*
);
DLL_EXPORT
int32_t
tmq_list_get_size
(
const
tmq_list_t
*
);
DLL_EXPORT
char
**
tmq_list_to_c_array
(
const
tmq_list_t
*
);
DLL_EXPORT
tmq_t
*
tmq_consumer_new
(
tmq_conf_t
*
conf
,
char
*
errstr
,
int32_t
errstrLen
);
DLL_EXPORT
int32_t
tmq_subscribe
(
tmq_t
*
tmq
,
const
tmq_list_t
*
topic_list
);
DLL_EXPORT
int32_t
tmq_unsubscribe
(
tmq_t
*
tmq
);
DLL_EXPORT
int32_t
tmq_subscription
(
tmq_t
*
tmq
,
tmq_list_t
**
topics
);
...
...
@@ -289,34 +296,17 @@ DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg);
DLL_EXPORT
void
tmq_commit_async
(
tmq_t
*
tmq
,
const
TAOS_RES
*
msg
,
tmq_commit_cb
*
cb
,
void
*
param
);
DLL_EXPORT
int32_t
tmq_commit_offset_sync
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
,
int64_t
offset
);
DLL_EXPORT
void
tmq_commit_offset_async
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
,
int64_t
offset
,
tmq_commit_cb
*
cb
,
void
*
param
);
DLL_EXPORT
int32_t
tmq_get_topic_assignment
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
tmq_topic_assignment
**
assignment
,
int32_t
*
numOfAssignment
);
DLL_EXPORT
int32_t
tmq_get_topic_assignment
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
tmq_topic_assignment
**
assignment
,
int32_t
*
numOfAssignment
);
DLL_EXPORT
void
tmq_free_assignment
(
tmq_topic_assignment
*
pAssignment
);
DLL_EXPORT
int32_t
tmq_offset_seek
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
,
int64_t
offset
);
DLL_EXPORT
int64_t
tmq_position
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
);
DLL_EXPORT
int64_t
tmq_committed
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
);
DLL_EXPORT
const
char
*
tmq_get_topic_name
(
TAOS_RES
*
res
);
DLL_EXPORT
const
char
*
tmq_get_db_name
(
TAOS_RES
*
res
);
DLL_EXPORT
int32_t
tmq_get_vgroup_id
(
TAOS_RES
*
res
);
DLL_EXPORT
int64_t
tmq_get_vgroup_offset
(
TAOS_RES
*
res
);
DLL_EXPORT
int64_t
tmq_position
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
);
DLL_EXPORT
int64_t
tmq_committed
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
);
/* ----------------------TMQ CONFIGURATION INTERFACE---------------------- */
enum
tmq_conf_res_t
{
TMQ_CONF_UNKNOWN
=
-
2
,
TMQ_CONF_INVALID
=
-
1
,
TMQ_CONF_OK
=
0
,
};
typedef
enum
tmq_conf_res_t
tmq_conf_res_t
;
DLL_EXPORT
tmq_conf_t
*
tmq_conf_new
();
DLL_EXPORT
tmq_conf_res_t
tmq_conf_set
(
tmq_conf_t
*
conf
,
const
char
*
key
,
const
char
*
value
);
DLL_EXPORT
void
tmq_conf_destroy
(
tmq_conf_t
*
conf
);
DLL_EXPORT
void
tmq_conf_set_auto_commit_cb
(
tmq_conf_t
*
conf
,
tmq_commit_cb
*
cb
,
void
*
param
);
/* -------------------------TMQ MSG HANDLE INTERFACE---------------------- */
DLL_EXPORT
const
char
*
tmq_err2str
(
int32_t
code
);
/* ------------------------------ TAOSX -----------------------------------*/
// note: following apis are unstable
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录