code: public void ack() throws IOException {
          String ackSubject;
          boolean isManualAck;
          StreamingConnectionImpl sc;
          // Look up subscription
          sub.rLock();
          try {
              ackSubject = sub.getAckInbox();
              isManualAck = sub.getOptions().isManualAcks();
              sc = sub.getConnection();
          } finally {
              sub.rUnlock();
          }
  
          // Check for error conditions.
          if (sc == null) {
              throw new IllegalStateException(NatsStreaming.ERR_BAD_SUBSCRIPTION);
          }
          if (!isManualAck) {
              throw new IllegalStateException(StreamingConnectionImpl.ERR_MANUAL_ACK);
          }
  
          // Ack here.
          Ack ack = Ack.newBuilder().setSubject(getSubject()).setSequence(getSequence()).build();
          sc.getNatsConnection().publish(ackSubject, ack.toByteArray());
      }
docs: Acknowledges the message to the streaming cluster.
  
  @throws IOException if an I/O exception occurs