Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

2.0.7表模式下如何订阅实时数据

未关闭
#17,414 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
冷清
技术栈
java
领域
databases

调研方向

首先检查传递给 SubscriptionTableSessionBuilder 和 createTopic 的表模式 topic 配置,然后跟踪 SubscriptionTablePushConsumerBuilder 和 consumeListener 应如何接收通过 IoTDB MQTT 写入的行。使用所示的 database、table 和 test_topic 值重现该设置;当 consumer 接收到新插入的实时数据时即表示完成。

由索引模型根据 Issue 内容生成。

描述

`

  // 创建 topics
    try (final ISubscriptionTableSession session =  new SubscriptionTableSessionBuilder()
                         .host(host)
                         .port(port)
                         .username(user)
                         .password(password)
                         .build())
    {
        final Properties config = new Properties();
        config.put(TopicConstant.DATABASE_KEY, "酸奶");
        config.put(TopicConstant.TABLE_KEY, "金山_产线_灌装_老酸奶灌装机");
        config.put(TopicConstant.START_TIME_KEY, "now");
        config.put(TopicConstant.STRICT_KEY, "true");
        config.put(TopicConstant.MODE_KEY, TopicConstant.MODE_DEFAULT_VALUE);
        session.createTopic("test_topic", config);
        log.info("主题 {} 创建成功", "test_topic");
    }

    ThreadUtil.execute(() -> {
        // 创建消费者
        // push 模式
        final ISubscriptionTablePushConsumer consumer = new SubscriptionTablePushConsumerBuilder()
                .consumerId("c1").consumerGroupId("cg1")
                .host(host).port(port)
                .username(user).password("root")
                .consumeListener(message -> {
                    System.out.println( message );
                    return ConsumeResult.SUCCESS;
                })
                .build();
        try {
            Thread.currentThread().join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    });

`
以上代码中 我拿不到 实时数据。我的实时数据是通过iotdb 自带的 mqtt 写进去的。每次写进去 执行select 查询的时候已经查到新数据了。但是 这个订阅始终收不到数据。

主要语言
Java
星标
6.4k
派生
1.2k
平均合并
1 天 8 小时
30 天内合并 PR
129

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/iotdb 的其他 Issue

查看 apache/iotdb 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。