Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Grid Manager hangs creating event topic subscription #2197

Open
2 of 3 tasks
afrancoc2000 opened this issue Mar 17, 2023 · 1 comment
Open
2 of 3 tasks

Event Grid Manager hangs creating event topic subscription #2197

afrancoc2000 opened this issue Mar 17, 2023 · 1 comment
Assignees
Labels
customer-reported needs-triage question Further information is requested

Comments

@afrancoc2000
Copy link

Library name and version

com.azure.resourcemanager:azure-resourcemanager-eventgrid:1.2.0-beta.3

Sample Issue Type

  • Sample not working
  • Sample missing
  • Do not understand sample

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

EventSubscription eventSubscription = manager.topicEventSubscriptions()
  .define(eventSubscriptionName)
  .withExistingTopic(resourceGroupName, eventGridTopicName)
  .withDestination(destination)
  .create();

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

var url = URI.create("www.microsoft.com");
WebhookEventSubscriptionDestination destination = new WebhookEventSubscriptionDestination()
  .withEndpointUrl(url.toString());

EventSubscription eventSubscription = manager.topicEventSubscriptions()
  .define(eventSubscriptionName)
  .withExistingTopic(resourceGroupName, eventGridTopicName)
  .withDestination(destination)
  .create();

Environment

Java: 17
Windows 11
Maven 3.8.7
Intellij Idea 2021.3.3

@ghost ghost added needs-triage question Further information is requested customer-reported labels Mar 17, 2023
@afrancoc2000 afrancoc2000 changed the title Event Grid Manager hangs create event topic subscription Event Grid Manager hangs creating event topic subscription Mar 17, 2023
@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Mar 24, 2023

@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
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported needs-triage question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants