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

[QUERY] Design discussion on returning activation response for long-running API #39952

Open
1 of 2 tasks
weidongxu-microsoft opened this issue Apr 29, 2024 · 1 comment
Open
1 of 2 tasks
Labels
Client This issue points to a problem in the data-plane of the library. needs-team-attention This issue needs attention from Azure service team or SDK team

Comments

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Apr 29, 2024

Query/Question
Service is Face.
Some API in it would return a response upon PUT/POST, which is useful for user, even before the LRO complete.

Our guideline would use SyncPoller for the LRO, but the activation response is not accessible.

Possible design

None of them is / will be supported by emitter. So all involves customization in client.

One possible API response would be a model wrapping the ActivationResult and the SyncPoller<PollResult, FinalResult>. However this does not match the guideline.
Another problem is that the wrapper model would be different in async client, as it be Mono<ActivationResult> + PollerFlux<PollResult, FinalResult>

class SyncPollerContainer {
  ActivationResult activationResult;
  SyncPoller<PollResult, FinalResult> poller;
}

SyncPollerContainer beginOp();

Another possible API response would be a subclass of SyncPoller which one additional API as e.g. getActivationResult(). However, we cannot do this to the async client, as PollerFlux class is final.

class SyncPollerContainer extends SyncPoller {
  ActivationResult activationResult;
}

SyncPollerContainer beginOp();

One could leave out the LRO. The PUT/POST would not be framed as LRO, and just return e.g. Response<ActivationResult>. But SDK provide some helper function to convert the response to SyncPoller<PollResult, FinalResult> if user want to poll to completion.

Response<ActivationResult> opWithResponse();

Response<ActivationResult> response = opWithResponse();
SyncPoller<PollResult, FinalResult> poller = Helper.createPoller(response);

 
Setup (please complete the following information if applicable):

  • OS: [e.g. iOS]
  • IDE: [e.g. IntelliJ]
  • Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)]

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Query Added
  • Setup information Added
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. Cosmos needs-team-attention This issue needs attention from Azure service team or SDK team Service Attention This issue is responsible by Azure service team. labels Apr 29, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kushagraThapar @pjohari-ms @TheovanKraay.

@weidongxu-microsoft weidongxu-microsoft removed Cosmos Service Attention This issue is responsible by Azure service team. labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. needs-team-attention This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

No branches or pull requests

1 participant