Skip to content

Conversation

@mpodwysocki
Copy link
Contributor

Packages impacted by this PR

  • @azure/notification-hubs

Issues associated with this PR

Describe the problem that is addressed by this PR

Moves @azure/notification-hubs to @azure/core-lro v3 beta.

What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?

Are there test cases added in this PR? (If not, why?)

Provide a list of related PRs (if any)

Command used to generate this PR:**(Applicable only to SDK release request PRs)

Checklists

  • Added impacted package name to the issue description
  • Does this PR needs any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here)
  • Added a changelog (if necessary)

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

@azure/notification-hubs

@mpodwysocki mpodwysocki requested a review from joheredi May 30, 2024 18:57

try {
if (!poller.isDone()) {
if (!poller.isDone) {
Copy link
Member

@MaryGao MaryGao Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me clarify my understanding for existing implementation first:

  • In notification hub, we refer the core-lro interface but re-implemented the poller in SDK side;
  • For operation beginSubmitNotificationHubJob, the method submitNotificationHubJob is to call initial request to trigger the LRO and the getNotificationHubJob is to retreive the poller status;
  • For poller's state, it is initialized with notStarted here and update its value only poll method. This is different from core-lro, in core-lro we update the state in two places: 1)initial request is back or 2)poll is called(considering the case where LRO is completed when initial request is back).

getOperationState(): OperationState<NotificationHubJob> {
return state;
async serialize(): Promise<string> {
return JSON.stringify({ state });
Copy link
Member

@MaryGao MaryGao Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if customers only created this poller and didn't call any poll or pollUntilDone to update the state.

Then they would get the string like { status: "notStarted" }?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, but I don't think that's incorrect. As I understand, the state will reflect the state at a given instant, so when creating the Poller the status is "notStarted" if we don't poll, the status is true.

I think the decision to poll when the poller is created is something each library may want to make. Specially if they implement their pollers like here. In codegen we decided to poll immediatly after creation, however there are 2 things to consider in Notification Hubs. I don't think aligning to the core implementation is a must, especially since the current implementation has been released.

  1. Would changing the current implementation to poll automatically after creation add value to existing customers?
  2. How disruptive this change would be for existing customers. Even if we are taking a breaking change, we need to make sure we don't cause unecessary friction.


getResult(): NotificationHubJob | undefined {
return state.result;
async submitted() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In core-lro we resolve submitted promise with two conditions 1) the initial request is back and 2) the poller is initialized(not notStarted status).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly we could make this return true as soon as the initial response is sent?

@mpodwysocki mpodwysocki requested review from a team as code owners July 11, 2024 21:10
import { PollerLike } from '@azure/core-lro';

// @public
export function beginGetNotificationDetails(context: NotificationHubsClientContext, notificationId: string, polledOperationOptions?: PolledOperationOptions): Promise<NotificationDetailsPoller>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the operation that will only be available to some SKUs but not to all correct? I was thinking, it may be a good idea to expose these operations in a separate subExport that makes it clear they are meant to be used for "non-basic" skus.

If we do this, I think it would be a good idea, instead of exposing an LRO for getting the notification details. Exposing a submitNotification that returns a PollerLike so that customers that have these Skus only need to call one operation instead of submit + check.

@mpodwysocki
Copy link
Contributor Author

Closed in favor of #31002

@mpodwysocki mpodwysocki closed this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants