T - Type of poll response value.public final class PollResponse<T> extends Object
status of the long-running operation, any value returned in the poll, as well
as other useful information provided by the service.
Code Sample Creating PollResponse Object
// Lets say we want to crete poll response with status as IN_PROGRESSPollResponse<String> inProgressPollResponse = newPollResponse<>(PollResponse.OperationStatus.IN_PROGRESS, "my custom response");
Code Sample Creating PollResponse Object with custom status
// Lets say we want to crete poll response with custom status as OTHER_CUSTOM_STATUSPollResponse<String> pollResponseWithCustomStatus = newPollResponse<>(PollResponse.OperationStatus.fromString("OTHER_CUSTOM_STATUS"), "my custom status response");
PollResponse.OperationStatus,
Poller| Modifier and Type | Class and Description |
|---|---|
static class |
PollResponse.OperationStatus
An enum to represent all possible states that a long-running operation may find itself in.
|
| Constructor and Description |
|---|
PollResponse(PollResponse.OperationStatus status,
T value)
Creates a new
PollResponse with status and value. |
PollResponse(PollResponse.OperationStatus status,
T value,
Duration retryAfter)
Creates a new
PollResponse with status, value and retryAfter. |
PollResponse(PollResponse.OperationStatus status,
T value,
Duration retryAfter,
Map<Object,Object> properties)
Creates a new
PollResponse with status, value, retryAfter and properties. |
| Modifier and Type | Method and Description |
|---|---|
Map<Object,Object> |
getProperties()
A map of properties provided by the service that will be made available into the next poll operation.
|
Duration |
getRetryAfter()
Returns the delay the service has requested until the next polling operation is performed.
|
PollResponse.OperationStatus |
getStatus()
Represents the status of the long-running operation at the time the last polling operation finished successfully.
|
T |
getValue()
The value returned as a result of the last successful poll operation.
|
public PollResponse(PollResponse.OperationStatus status, T value, Duration retryAfter, Map<Object,Object> properties)
PollResponse with status, value, retryAfter and properties.
Code Sample Creating PollResponse Object
// We can store some properties which we might need to execute poll Operation call.Map<Object,Object> prop = newHashMap<>(); prop.put("service.url", "http://azure.service.url"); prop.put("customer.id", 2635342); // Lets say we want to crete poll response with status as IN_PROGRESSPollResponse<String> inProgressPollResponse = newPollResponse<>(PollResponse.OperationStatus.IN_PROGRESS, "mycustom response",Duration.ofMillis(2000), prop);
status - Mandatory operation status as defined in PollResponse.OperationStatus.value - The value as a result of poll operation. This can be any custom user-defined object. Null is also valid.retryAfter - Represents the delay the service has requested until the next polling operation is performed.
A null, zero or negative value will be taken to mean that the Poller should determine on its own when the next poll operation is to occur.properties - A map of properties provided by the service that will be made available into the next poll operation.NullPointerException - If status is null.public PollResponse(PollResponse.OperationStatus status, T value, Duration retryAfter)
PollResponse with status, value and retryAfter.
Code Sample Creating PollResponse Object
// Lets say we want to crete poll response with status as IN_PROGRESS // If nextRetry should happen after 2 seconds ...PollResponse<String> inProgressPollResponse = newPollResponse<>(PollResponse.OperationStatus.IN_PROGRESS, "my custom response",Duration.ofMillis(2000));
status - Mandatory operation status as defined in PollResponse.OperationStatus.value - The value as a result of poll operation. This can be any custom user-defined object. Null is also valid.retryAfter - Represents the delay the service has requested until the next polling operation is performed.
A null, zero or negative value will be taken to mean that the Poller should determine on its own when the next poll operation is to occur.NullPointerException - If status is null.public PollResponse(PollResponse.OperationStatus status, T value)
PollResponse with status and value.
Code Sample Creating PollResponse Object
// Lets say we want to crete poll response with status as IN_PROGRESSPollResponse<String> inProgressPollResponse = newPollResponse<>(PollResponse.OperationStatus.IN_PROGRESS, "my custom response");
status - Mandatory operation status as defined in PollResponse.OperationStatus.value - The value as a result of poll operation. This can be any custom user-defined object. Null is also valid.NullPointerException - If status is null.public PollResponse.OperationStatus getStatus()
PollResponse.OperationStatus representing the result of the poll operation.public T getValue()
public Duration getRetryAfter()
Poller should determine on its own when the next poll operation is to occur.Copyright © 2019 Microsoft Corporation. All rights reserved.