You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "xuan.wang (Jira)" <ji...@apache.org> on 2023/03/31 08:15:00 UTC

[jira] [Created] (IOTDB-5750) [subscription]add push-base subscription client sdk

xuan.wang created IOTDB-5750:
--------------------------------

             Summary: [subscription]add push-base subscription client sdk
                 Key: IOTDB-5750
                 URL: https://issues.apache.org/jira/browse/IOTDB-5750
             Project: Apache IoTDB
          Issue Type: New Feature
          Components: Others
            Reporter: xuan.wang


add push-base subscription client sdk

only client sdk,Does not include server 
{code:java}
// use case
try (IPushConsumer pushConsumer =
    (new SubscriptionFactory())
        .createPushConsumer(
            new SubscriptionConfiguration.Builder()
                .host("localhost")
                .port(6667)
                .localHost("localhost")
                .localPort(9997)
                .username("root")
                .password("root")
                .topicStrategy(new SingleTopicStrategy("root.sg1"))
                .disorderHandlingStrategy(new IntolerableStrategy())
                .build())) {
  pushConsumer.registerDataArrivalListener(
      (data) -> {
        System.out.println("Start Data arrived----------------------------------");
        data.forEach(
            (item) -> {
              System.out.printf(
                  "Time: %s, paths: %s, values: ",
                  item.getTime(), String.join("、", item.getColumnNames()));
              if (item.getColumnNames().size() > 0) {
                for (int i = 0; i < item.getColumnNames().size(); i++) {
                  System.out.printf("%s, ", item.Data().getInt(i));
                }
              }
              System.out.println();
            });
        System.out.println("End Data arrived----------------------------------");
      });
  pushConsumer.openSubscription();
  pushConsumer.start(); {code}
 

添加推送模式的消息订阅客户端sdk

只有客户端,不含订阅服务的



--
This message was sent by Atlassian Jira
(v8.20.10#820010)