Bulk ingester no close at the end

I read the documents but it is not clear to me.

I have this code:

public void indexProduct(Product product) {
try (BulkIngester<String> bulkIngester = indexingService.createBulkIngester()) {
      indexingService.bulkIngestWithAsset(product, bulkIngester);
    } catch (InterruptedException e) {
      throw new RuntimeException(e);

for((int i=0; i<10; i++) {



Then I will not close.

Is this ok?


You should check if the resource implements java.lang.AutoCloseable, if yes the resource will be closed as soon as the try-catch block is executed.

Hi, the resource does not implement java.lang.AutoCloseable

Is it same as BulkProcessor wherein you have .awaitclose()

And BulkIngester have .close() only

In this case, it is better to make the .close explicit.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.