code: public boolean commit(String topic) {
          KafkaConsumer<String, byte[]> consumer = _getConsumer(topic);
          synchronized (consumer) {
              Set<String> subscription = consumer.subscription();
              if (subscription == null || !subscription.contains(topic)) {
                  // this consumer has not subscribed to the topic
                  return false;
              }
              try {
                  consumer.commitSync();
              } catch (WakeupException e) {
              } catch (Exception e) {
                  throw new KafkaException(e);
              }
              return true;
          }
      }
docs: Commit offsets returned on the last poll for all the subscribed
  partitions.
  
  @param topic
  @return {@code true} if the topic is in subscription list, {@code false}
  otherwise
  @since 1.3.2