Open afrancoc2000 opened 1 year ago
@XiaofeiCao feel free to move the azure-sdk-for-java repo
I think author asks how to abort/timeout a LRO. Note this is Lite lib, we don't have async API there.
As fallback, one can do this
SyncPoller<PollResult<?>, EventSubscriptionInner> poller =
eventGridManager.serviceClient().getTopicEventSubscriptions()
.beginCreateOrUpdate(...);
PollResponse<PollResult<?>> lastResponse = poller.waitForCompletion(Duration.ofMinutes(10));
if (lastResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
// succeeded
EventSubscriptionInner result = poller.getFinalResult();
} else {
// failed or not completed in time
}
Library name and version
com.azure.resourcemanager:azure-resourcemanager-eventgrid:1.2.0-beta.3
Sample Issue Type
Issue details
I'm trying to create a subscription using the EventGridManager, if the webhook endpoint for the destination is good everything works, but if the endpoint is not a valid webhook, the service hangs indefinitely. Is there a way to set a timeout? so that the service doesn't hangs, as right now I need to interrupt the thread.
Thanks
Expected behavior
If the endpoint is not valid a timeout a default timeout happens and fails, and this timeout can be set from the create method.
Actual behavior
On wrong endpoint the thread hangs indefinitely
Reproduction Steps
Try to create a subscription using "www.microsoft.com" as endpoint
Environment
Java: 17 Windows 11 Maven 3.8.7 Intellij Idea 2021.3.3