[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-18 UTC."],[],[],null,["# AsyncApiOperation\n\npublic class **AsyncApiOperation** extends Object \nAn [ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) that the [Repository](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/Repository) pushes asynchronously.\n\nThe [Repository](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/Repository) can push [AsyncApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/AsyncApiOperation) objects using the [EventBus](/workspace/cloud-search/docs/reference/sdk/com/google/common/eventbus/EventBus)\npassed in from its [init(RepositoryContext)](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/Repository#init(com.google.enterprise.cloudsearch.sdk.indexing.template.RepositoryContext)) method. Typically, the\n[Repository](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/Repository) performs on-demand API operations whenever it implements a scheduled or\nevent-driven change-detection mechanism.\n\nThe [ListenableFuture](/workspace/cloud-search/docs/reference/sdk/com/google/common/util/concurrent/ListenableFuture) result represents the future result of the operation accessible\nfrom [getResult()](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/AsyncApiOperation#getResult()).\n\nSample usage:\n\n\n public MyRepository implements Repository {\n @Override\n public void init(RepositoryContext context) {\n this.context = context;\n }\n\n private void onDocumentRemoved(String docId) {\n AsyncApiOperation operation = new AsyncApiOperation(ApiOperations.deleteItem(docId));\n this.context.postAsyncOperation(operation);\n }\n\n // other implemented methods\n }\n \n\u003cbr /\u003e\n\n### Public Constructor Summary\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [AsyncApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/AsyncApiOperation#AsyncApiOperation(com.google.enterprise.cloudsearch.sdk.indexing.template.ApiOperation))([ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) operation) Constructs [AsyncApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/AsyncApiOperation) to be posted on [postAsyncOperation(AsyncApiOperation)](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/RepositoryContext#postAsyncOperation(com.google.enterprise.cloudsearch.sdk.indexing.template.AsyncApiOperation)). |\n\n### Public Method Summary\n\n|---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) | [getOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/AsyncApiOperation#getOperation())() Gets [ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) to be executed. |\n| ListenableFuture\\\u003cList\\\u003cGenericJson\\\u003e\\\u003e | [getResult](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/AsyncApiOperation#getResult())() Gets result for [ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) operation execution. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public\n**AsyncApiOperation**\n([ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) operation)\n\nConstructs [AsyncApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/AsyncApiOperation) to be posted on [postAsyncOperation(AsyncApiOperation)](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/RepositoryContext#postAsyncOperation(com.google.enterprise.cloudsearch.sdk.indexing.template.AsyncApiOperation)). \n\n##### Parameters\n\n| operation | [ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) to be executed asynchronously. |\n|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public [ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation)\n**getOperation**\n()\n\nGets [ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) to be executed. \n\n##### Returns\n\n- operation to be executed. \n\n#### public ListenableFuture\\\u003cList\\\u003cGenericJson\\\u003e\\\u003e\n**getResult**\n()\n\nGets result for [ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) operation execution. \n\n##### Returns\n\n- result for [ApiOperation](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ApiOperation) operation execution."]]