private static void dataSubscription4() throws Exception {
    try (final SubscriptionTreeSession subscriptionSession =
        new SubscriptionTreeSession(HOST, PORT)) {
      subscriptionSession.open();
      final Properties config = new Properties();
      config.put(TopicConstant.FORMAT_KEY, TopicConstant.FORMAT_TS_FILE_HANDLER_VALUE);
      config.put(TopicConstant.MODE_KEY, TopicConstant.MODE_SNAPSHOT_VALUE);
      subscriptionSession.createTopic(TOPIC_4, config);
    }

    final AtomicLong counter = new AtomicLong();
    final List<Thread> threads = new ArrayList<>();
    for (int i = 0; i < PARALLELISM; ++i) {
      final int idx = i;
      final Thread thread =
          new Thread(
              () -> {
                // Subscription: builder-style ctor
                try (final SubscriptionTreePullConsumer consumer4 =
                    new SubscriptionTreePullConsumer.Builder()
                        .consumerId("c" + idx)
                        .consumerGroupId("cg4")
                        .autoCommit(true)
                        .fileSaveFsync(true)
                        .buildPullConsumer()) {
                  consumer4.open();
                  consumer4.subscribe(TOPIC_4);
                  while (!consumer4.allTopicMessagesHaveBeenConsumed()) {
                    for (final SubscriptionMessage message : consumer4.poll(POLL_TIMEOUT_MS)) {
                      final SubscriptionTsFileHandler handler = message.getTsFileHandler();
                      handler.moveFile(
                          Paths.get(System.getProperty("user.dir"), "exported-tsfiles")
                              .resolve(
                                  URLEncoder.encode(TOPIC_4)
                                      + "-"
                                      + counter.getAndIncrement()
                                      + ".tsfile"));
                    }
                  }
                } catch (final IOException e) {
                  throw new RuntimeException(e);
                }
              });
      thread.start();
      threads.add(thread);
    }

    for (final Thread thread : threads) {
      thread.join();
    }
  }
multi pull consumer subscribe topic with tsfile format and snapshot mode
example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java