K
- type of the operation key under which the result future is storedR
- type of the operation resultpublic abstract class AbstractAsynchronousOperationHandlers<K extends OperationKey,R> extends Object
Some operations are long-running. To avoid blocking HTTP connections, these operations are executed in two steps. First, an HTTP request is issued to trigger the operation asynchronously. The request will be assigned a trigger id, which is returned in the response body. Next, the returned id should be used to poll the status of the operation until it is finished.
An operation is triggered by sending an HTTP POST
request to a registered url
. The HTTP
request may contain a JSON body to specify additional parameters, e.g.,
{ "target-directory": "/tmp" }As written above, the response will contain a request id, e.g.,
{ "request-id": "7d273f5a62eb4730b9dea8e833733c1e" }
To poll for the status of an ongoing operation, an HTTP GET
request is issued to
url/:triggerid
. If the specified savepoint is still ongoing,
the response will be
{ "status": { "id": "IN_PROGRESS" } }If the specified operation has completed, the status id will transition to
COMPLETED
, and
the response will additionally contain information about the operation result:
{ "status": { "id": "COMPLETED" }, "operation": { "result": "/tmp/savepoint-d9813b-8a68e674325b" } }
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractAsynchronousOperationHandlers.StatusHandler<T extends RestfulGateway,V,M extends MessageParameters>
Handler which will be polled to retrieve the asynchronous operation's result.
|
protected class |
AbstractAsynchronousOperationHandlers.TriggerHandler<T extends RestfulGateway,B extends RequestBody,M extends MessageParameters>
Handler which is responsible for triggering an asynchronous operation.
|
Constructor and Description |
---|
AbstractAsynchronousOperationHandlers() |
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.